Ruth Hendrix

PART 1: Assembly programming for HCS12X

Discussion created by Ruth Hendrix Employee on Jan 26, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
READ PART 2, 3
 
Posted: Tue Jun 14, 2005 8:44 pm    
 
Not to single out any companies (largely becuase we have had equally bad luck with the assembler and IDEs) but holy moses can anyone make a decent assembler for the S12X? Anyone planning on adding Global Addressing?? I highly doubt anyone out there has a decent ASM project for the 12X outside of the examples given by the major companies. Friends and I have tried the Cosmic and Metrowerks tools and there are things about each we found problematic. We have liked using P&E's assembler in the past but they don't have one for the S12X yet. I suspect the C tools work better largely because they are more of a selling point of the product but to leave ASM programmers without a good set of tools is not a good idea I think. One of the responses we recieved from Metrowerks was "the 12X is a much too powerful chip to program in assembly." Maybe writing optimized ASM code to push the limits of the S12X wasn't a design criteria?
Posted: Tue Jun 14, 2005 8:57 pm    
 
I guess the larger problem (at least with metrowerks still playing wtih Cosmic) is when you have continuous code spanning pages of memory. P&E was able to handle this with there logical2physical program that you had to run on your S records before programming (I made a command line driven version of this myself actually so I could run in a batch file after assembly)
Posted: Wed Jun 15, 2005 12:41 pm    
 
May be nobody bothered, so far, to take the huge hassle of dealing with all the paging on a big project. And the big guys did but this is proprietary code.

Personally, I would consider the option of writing C code and then see the ASM to optimize it, if the project is not too big.
Posted: Wed Jun 15, 2005 12:46 pm    
 
Hmm if by big you mean you could round it to a nearest 100K lines of ASM ? Laughing
Posted: Wed Jun 15, 2005 5:25 pm    
 
If the project has a deadline of 10 years, why not ? Confused
I like the portability of C between FSL MCUs. I use it quite a lot to use same/similar functions between micros without having to check where's what.
It's even possible cross cores, when you don't necessarily have same instruction set. Razz
Posted: Thu Jun 16, 2005 9:56 am    
 
Quote:
Anyone planning on adding Global Addressing??


Not sure what you mean by this. I guess the assemblers support the global load & store opcodes and GPAGE is writable, so is it a problem with linking large code in global space or what?
 
Posted: Thu Jun 16, 2005 12:44 pm    
 
On my way out but I'll add a quick note about why ASM vs. C - all components of the code are time critical. All of the functions and IO it is doing are based on small windows of oppurtunity so when an event I or O happens it needs to get done ASAP and be ready for the next one. One of the reasons the shift to the S12X was to offload some of the code on the XGate because in certain situations the S12 could be come overrun with tasks and miss the timing on its I or O routines. Just need P&E to release their assembler for the 12X I suppose Smile.
Posted: Thu Jun 16, 2005 9:00 pm    
 
Quote:
Not sure what you mean by this. I guess the assemblers support the global load & store opcodes and GPAGE is writable, so is it a problem with linking large code in global space or what?


Yes this is the problem. The problem is linking a 40K continous block of code starting at 4000

So.. if you take a 220K ASM project and convert it to C what does that turn into? Would that fit on a 512 I doubt ? Wink

Another fun thing is try scrolling past 2^15 lines of code in codewarrior? Hmm.. Fun.. You can page down and down arrow key past that. that's it. Otherwise you go back to line 1.

Edit - the only reason it is 220k (at this point) is we started with a 128 then moved to a 256 and were like o boy this isn't gonna fit on a 256 either! We even wrote our own optimized compression routines for data to try and scrunch it as much as possible!
Posted: Thu Jun 16, 2005 9:25 pm    
 
I wouldn't be surprised if Joachim, the guy who designed it has one, I will drop him a line and ask.
Posted: Thu Jun 16, 2005 10:48 pm    
 
Cool! Thanks freegeek! What did Joachim design? The S12X? CodeWarrior? An S12X app? I apreciate your assistance! We talked to a freescale rep today and told them about our probs dealing w/ metrowerks. They are gonna do some calling too.
Lets first define what a decent assembler for hard core assembler programmers is.

#1 supports a linker allowing mulitple files
#2 can also to link C or other high level languages
#3 supports assembler source level debugging (#2 & #3 fall to ELF/DWARF format probably)
#4 supports user definable macros to pack several lines of assembersomething like inlining.
#5 supports nested include files
#6 supports arbitrary long names
#7 supports all available instructions

Here is what I am aware of being around:
- Metrowerks built in with their C-Compiler. from my point of view only useable for smaller projects, mainly an inline assembler for C-programs.

- COSMIC - have not done much with COSMIC overhere
- inline asembler like in metrowerks
- got also in the past a very nice crossassembler. Not sure if this is still supported, but definetly worth asking.

- gcc for 6812
- global addressing is not included
- In my old days I used CRASMB on an operating system called Flex, but don';t think its around anymore. Google provide two hits on <crasmb cross assembler>

The following is sightly off-track of this thread
resading through the email, I think there is a mismatch on the expectations what global addressing means and what it actually does.
The global addressing is only intended for addressing larger data structures up to 64kBytes much more efficiently than with the S12.
It is NOT useable for program space, where the CALL/RTC provides a very effcient mechanism to get around in a large space.
If the user however has a larger linear assembler program it has to be split basically into chunks of 16k bytes of code all in the logical 0x8000 - 0xBFFF (plus to fixed pages) before bringing it all together.
 
Posted: Fri Jun 17, 2005 10:06 pm  
 
For my hobby projects I wrote an assembler which supports bullets #3, #5, #6, and #7. It supports a logical and a physical address scheme (which can be interpreted as local and global addresses) and it handles S12, S12X, and XGATE mnemonics.
Just like the "official" AS12 my assembler uses #include directives to handle multiple files. Its output is a D-BUG12 compliant S-Record file (no postprocessing needed).

Anyone who would like to try it out can find it here: http://home.arcor.de/hotwolf
Posted: Fri Jun 17, 2005 10:12 pm    
 
Wow I am very impressed!
Posted: Fri Jun 17, 2005 10:15 pm    
 
 just tried to download you software are recieved a 404 not found error.
Posted: Fri Jun 17, 2005 10:45 pm    
 
Quote:
What did xxx design?
He invented the S12 and S12X and is the smartest designer I know. Very Happy

Message Edited by RChapman on 01-26-2006 11:56 AM

Message Edited by RChapman on 01-26-2006 12:03 PM

Outcomes