CW + HCS12 + assembly only = ??

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW + HCS12 + assembly only = ??

5,214 Views
GaryOlmstead
Senior Contributor I
I am converting an old (OLD!) 100% assembly HC11 program to HCS12A32.  I don't have time to convert it to C, so I created a new CW project (assembly only, Softec debug), and added my code.  It appears to assemble OK, but the linker is giving me grief.  In theory, I shouldn't even need the linker, so I shut it off.  Trouble is, now I can't find anything that looks like an output file.  I'm not getting any error messages, but I'm also not getting any .s19, .map, .obj, .lst or anything else I recognize.  Can you supply any suggestions?
 
Gary Olmstead
Toucan Technology
Ventura CA
 
Labels (1)
Tags (1)
0 Kudos
10 Replies

707 Views
mke_et
Contributor IV
I'm wondering what you mean by unable to make a single file. I'm using a DG128 part and I have all but one of the 16K flash pages filled.

I use absolute assembly, and it's not that much of a hit to define everything at the start. I wrote the code so that all my 'configurable modules' are on switchable pages in the flash with an identification header. In my init routine I walk the pages, and if I find the header I add that page to my module list. I wrote my own 'swapper' but I'm pretty sure I could have done it automatically, however I make it so the pages can be built and moved around. Every module 'thinks' it's on the page area in 64K space with normal calls and returns.

By the way, what kind of 'conversion' did you have to do to get the HC11 code over to the 12? Depending on your 11 tools, there may be 'gotchas' that you missed. I was fighting some of the '!' declarations, as well as the default for hex or decimal in the source. And then a lot of coditionals bit me big time, since coding size was different. I even ran into a few logic errors. The 12 is so much simpler and I had a few things that 'worked by accident' on the 11 then failed with glory on the 12!

Tell you what I would do first. Start with a BLANK project. NOTHING in it at all. Then with a single 'main.asm' file just declare absentry mainstart then org $C000. Then put a mainstart jmp mainstart. Build it and check your Sxx records. Build it for the simulator I suppose, and see if you can exercise it. THEN start trying to put in your code into THAT main.asm file.

Mike
0 Kudos

707 Views
GaryOlmstead
Senior Contributor I

mke_et --

I mean that I am too lazy to deal with a single file that is over 10,000 lines long.  Admittedly, about half of that is mc9s12a32.inc and I am using about 1% of that.  But entering it from scratch would mean debugging it, and I really don't have that sort of time.

My HC11 tool was MCUasm, I never used the "!" declarations, all my "magic numbers" are symbolics in the code with a single module devoted to defining them and they are practically all hex anyway.

I do use conditionals, but none of them created any problems.

The biggest "problem" I had was that the HCS12 had so many more resources that I was able to get rid of a bunch of external timers, etc, and move it on board.  Of course, then I had to re-think functions that I hadn't thought about since I first wrote that code, many, many years ago.

0 Kudos

707 Views
bigmac
Specialist III

Hello Gary,

If you are using absolute assembly, you don't really need to create a CW project.  Simply run the assembler program as a separate tool, in isolation from the IDE, and it will generate the necessary output files directly (without the linker).  Assuming your include files are in the same directory as the main ASM file, you may need to load a "default" project.ini file located in same directory, so the assembler can find your include files.

Regards,
Mac

 

0 Kudos

707 Views
GaryOlmstead
Senior Contributor I
bigmac--
 
Absolute assembly would be great, but the existing program is in 12 source files, plus three header files.  And it's far too large to just concantenate everything.  So, it's gotta be relocatable.  Nice idea, though.
 
Gary Olmstead
Toucan Technology
Ventura CA
 
0 Kudos

707 Views
CrasyCat
Specialist III

Hello

First you have to decide whether you want to use absolute or relocatable assembly.
In absolute assembly you have one single assembly unit (i.e. a source file and n include file) assembled as a whole in one step. All section have to be absolute in that mode.

If you decide to go with relocatable assembly (i.e. Several assembly source files assembled separately), you have to use the linker to build the final application.

What do you mean exactly when you say the linker is not happy? What does he report back?

CrasyCat

0 Kudos

707 Views
GaryOlmstead
Senior Contributor I

CrasyCat --

My understanding of absolute assembly is that it all has to be in one source file.  The source files for this program take up over 600K (I comment rather more heavily than most), and I am too lazy to scroll past all that stuff to get to what I need.

The linker returns a "L1923: File (filename) has no DWARF debug info".  Insert the name of each of the 12 files for (filename).  It doesn't have DWARF debug info because it is assembly, according to the help for L1923.  The help goes on to say that generating debug info can be skipped, but doesn't say how, and I have been unable to guess where it might be.  The messages are annoying, but I can live with annoying.

The linker also returns a "L1115: Function Entry not found" and a "L1106 Object Entry not found".  The help for these says they are generated if no "main" function exists.  The problem is that it does exist, it is called main, and it is specified in Edit > Softec Settings > Debugger Settings.

0 Kudos

707 Views
CompilerGuru
NXP Employee
NXP Employee
Absolute assembly has to be one source file, but this source file can include any number of other files. But for larger projects, I would also use relocatable assembly.
The "L1923: File (filename) has no DWARF debug info" message means that you did not generate debug information for those files. There is a little dot in the Files tab in the project window which you can use to enable the generation of debug info. Both, the compiler and the assembler can be configured to generate (or not to generate) debug info. Without debug info, the application does still link, but you wont be able to use source stepping.
To fix "L1115: Function Entry not found", open the prm file and add/adapt the INIT entry. The *.prm file (and not the debugger preference) does configure the linker.
Alternatively, define the Entry symbol in your application.

Daniel

BTW: The Debugger Settings preferences are not used at all, so they dont show up anymore in the current HC12 V4.5 release.
0 Kudos

707 Views
GaryOlmstead
Senior Contributor I
Compiler Guru--
 
So, that is what that little dot is for.  That worked fine.
 
There didn't appear to be a .prm file.  The "Use PRM from project" button was selected, but there wasn't any PRM file in that folder.  So, I selected the template PRM for the 'A32 and hit compile.  That appeared to work, at least I now have S19 and PHY files.  I haven't tried to download it yet.
 
Thank you, one and all, for all the help.
 
Gary Olmstead
Toucan Technology
Ventura CA
 
0 Kudos

707 Views
mke_et
Contributor IV
When you put files names into the mcp file, did it prompt you for targets?

I'm not in front of the machine that I use for my projects right now, but I remember I had to do some tricks the very first time I did an assembly.

I'm gonna assume that you converted all your startup over to the 12 correctly. And that you configured where things go.

Ok, first question... Did you try to use any of the built in stuff, or go right to your asm file directly and then just include all your files?
0 Kudos

707 Views
GaryOlmstead
Senior Contributor I
mke_et --
 
umm... I'm pretty sure it did prompt for targets.  I have created CW projects before, and this time was enough like the other times that it didn't raise any alarms. ...  I just checked, and Project > SetDefaultTarget brings up Softec with a check mark beside it.
 
mke_et wrote "I'm gonna assume that you converted..."
 
That may not be a good assumption.  The old code was written for MCUasm, and I just right clicked and selected Add files.  Then I rewrote the bits that referred to peripheral registers and hit Make.
 
Which built-in stuff are you referring to?
 
Gary Olmstead
Toucan Technology
Ventura CA
 
0 Kudos