HC08: Filling unused memory,and getting the code to "compile" properly

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

HC08: Filling unused memory,and getting the code to "compile" properly

3,842 Views
Ali2006
Contributor II
Hello All,
 
I'm new to the code warrior assembly software programming so please excuse my ignorance.
 
I'm trying to create a simple assembly file that's been converted from an old HC05 code. 
The file uses ORG's to set the locations of the code and vectors etc.
 
I'm trying to get the code warrior software to give me the correct outputs.
and I'm also trying to Fill the unused CODE space with SWI's, which in my case is a 0x83
I'm using the HCS08QG8 processor.
 
I setup my project from the start as an Absolute Assembly project with the Full chip emulator choosen as the target and got everything to compile just fine, but there was no S records, no listing generated, and no map file.
 
I then found out about the .prm files and am using the following..
Code:
/* Define Starting Point for filt*/INIT RESETNAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */    ROM                      =  READ_ONLY    0xE000 TO 0xFFAD FILL 0x83;                                     Z_RAM                    =  READ_WRITE   0x0060 TO 0x00FF;    RAM                      =  READ_WRITE   0x0100 TO 0x025F;    ROM1                     =  READ_ONLY    0xFFC0 TO 0xFFCF;ENDPLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */    DEFAULT_RAM                          INTO  RAM;    DEFAULT_ROM, ROM_VAR, STRINGS        INTO  ROM; /* ROM1 In case you want to use ROM1 as well, be sure the option -OnB=b is passed to the compiler. */    _DATA_ZEROPAGE, MY_ZEROPAGE          INTO  Z_RAM;ENDSTACKSIZE 0x50VECTOR 0 RESET /* Reset vector: this is the default entry point for an application. */

 
Now when I compile the code I do get the .sx file, but it's filled with all 0x83's and nothing else.   If I don't use the FILL command my .sx file result isn't all that much better.  It only contains one S1 line which sets the reset vector to E000.
 
I tried to enter a SECTION name in the assembly file and then a new name in the PLACEMENT section, but they system told me that this was an absolute assembly file and I couldn't do that.
 
Obvioulsy I must be doing something wrong, but since I'm new to this I have no idea what..
 
Any assistance will be greatly appreciated.
 
P.S. I  saw on some other message that you need to have the Interrupt vectors secified in both the prm file and the assembly file.. Is that correct? Or is the RESET vector sufficient for setting the system up.
 

Message Edited by CrasyCat on 2007-04-13 02:17 PM

Labels (1)
Tags (1)
0 Kudos
10 Replies

770 Views
Nabla69
Contributor V
Hi,
 
From your description it means that no code is compiling.
Use the Project Wizard to create a new project based on assembler.
Then paste your assembly code in the /* put your code here */ area in the new project.
 
Try and compile, you should have either an error or something generated.
 
Another way to confirm no code is generated is to ask the compiler to create a LIST = LST file (compiler output options).
It will detail in text format what is compiled and how.
 
Alvin.
0 Kudos

770 Views
Ali2006
Contributor II
Hello again,
 
Thanks for the help...  I tried turning on the LIST function, but I don't find and .LST file being generated anywhere so I don't know..
 
I haven't tried building a new project yet, but I will soon and see if that helps me any.
 
I did play around a bit more.. and found that...
 
If I turn the linker off by choosing absolute assembly I do get a compiled .sx file in my ObjectCode folder
(Which i never noticed before).. If I just then switch to the Custom PRM file I get that somewhat blank .sx file.  But I've noticed the following.  If I explicitely put in to the NAMES section of the PRM file the .o file generated (without path information) the Linker doesn't seem to know where to get the .o file from and it gives me an error.  Without the explicit .o file in the names, then linker creates that somewhat empty .sx file.  Now I've noticed something else to.. that empty .sx file is located in the BIN directory, but if I go and look in the ObjectCode directory I do see the filename .sx file with the compiled code, but not the FILL information that I would like. 
 
If there is a way to get just the compiler to fill the unused memory that would work too as that's all I"m really trying to do.. That Listing file would be nice though I'm not sure why I'm not getting that.
 
Thanks again for any and all assistance.
0 Kudos

770 Views
CompilerGuru
NXP Employee
NXP Employee
Given this:
>I tried to enter a SECTION name in the assembly file and then a
>new name in the PLACEMENT section, but they system told me that
>this was an absolute assembly file and I couldn't do that.

This sounds as if you would specify -Fa2 with the assembler. With this, the assembler directly builds an application, and is not using the linker. The linker then takes the application as rom library (this are prebuilt apps) and does not extract its code therefore, so you end up with an empty srecrod.

Remove this option when using the linker, add it when using absolute assembly.
Anyway, I doubt that the FILL in the prm works with absolute code (ORG), but I'm not 100% sure. If you want to use absolute assembly, I would suggest to fill the remaining memory with the assembler too.
Something (not tested) (will only work in absolute code) like

DCB $FFAD-*,$83

at the end of your file should do it.

Daniel
0 Kudos

770 Views
Ali2006
Contributor II
Thanks again for your replys...
 



CompilerGuru wrote:
If you want to use absolute assembly, I would suggest to fill the remaining memory with the assembler too.
Something (not tested) (will only work in absolute code) like

DCB $FFAD-*,$83

at the end of your file should do it.

Daniel

And that works perfectly in the Absolute Assembly model.. Thank you very much..
 
But.. I'm still curious about a few things and for a learning benefit would like to ask a few more questions.
 
I did find that I was using -FA2 in the Assembler (not the compiler) settings and when I removed that from the settings and compiled with the linker and the prm file the "Project" .sx file now contains and entired filled memory with the 0x83's and then after that the code.. at exactly the same addresses.. Not quite what I was looking for.  For future reference if any one hase any ideas I'd greatly appreciate.
 
As an FYI to my previous question about the listing files.  I learned that I probably want an Assembler listing file, not a compiler listing file since my project is all in assembly..  My compiler listing file request was going totaly unanswered.  But once I found the Assembler listing file setting I do now get a listing file that I expected from the Assembler 
 
Thanks again for all the help.

 

0 Kudos

770 Views
CompilerGuru
NXP Employee
NXP Employee
>I did find that I was using -FA2 in the Assembler (not the compiler)
>settings and when I removed that from the settings and compiled with the
>linker and the prm file the "Project" .sx file now contains and entired
>filled memory with the 0x83's and then after that the code.. at exactly
>the same addresses.. Not quite what I was looking for. For future
>reference if any one hase any ideas I'd greatly appreciate.

I would expect to get some linker error messages for such a setup. Did you get any? Do you have any options in the linker tab, for some projects those linker errors are disabled because the same message is also issued for non initialized, absolute overlaps, and those dont hurt and happen when using multiple (or broken) derivative headers.

>My compiler listing file request was going totaly unanswered.
Use the compiler option -lasm causes the compiler to generate a listing
(corresponding assembler option is -L, I think), also the context menu contains a disassemble which is also just that if you do want to have the listing just on request and not during the build.
The linker is generating the map, and with absolute assembly no linker is used, hence no map file.

Daniel
0 Kudos

770 Views
Ali2006
Contributor II

>>I did find that I was using -FA2 in the Assembler (not the compiler)
>>settings and when I removed that from the settings and compiled with the
>>linker and the prm file the "Project" .sx file now contains and entired
>>filled memory with the 0x83's and then after that the code.. at exactly
>>the same addresses.. Not quite what I was looking for. For future
>>reference if any one hase any ideas I'd greatly appreciate.

>I would expect to get some linker error messages for such a setup. Did you get any? Do you have any >options in the linker tab, for some projects those linker errors are disabled because the same message >is also issued for non initialized, absolute overlaps, and those dont hurt and happen when using multiple >(or broken) derivative headers.

You are corrrect there are options selected in the linker tab that I didn't put there and it does seem that they are disabling those overlap warnings.   The options in the window were -WmsgSd1100 -WmsgSd1912.  Do you think that there is a way that I can use my ORG statements in the Code, and get the linker to function properly creating the .sx file or should I just stay with the absolute assembly method with no linker, and getting the .sx file from the ObjectCode directory.  The only reason I would do this is that the .sx file created by the linker ends up in the Bin directory which is where I would expect to look for it.


>>My compiler listing file request was going totaly unanswered.
>Use the compiler option -lasm causes the compiler to generate a listing
>(corresponding assembler option is -L, I think), also the context menu contains a disassemble which is >also just that if you do want to have the listing just on request and not during the build.

The compiler does have that -Lasm option in it's settings, but I think that the compiler is not being asked to do anything in my instance, since I'm all assembly language anyway.  I think that the compiler would only be called for a C project.  Am I correct?

Thanks again for all your assistance.

0 Kudos

770 Views
CompilerGuru
NXP Employee
NXP Employee
To get an srecord into the bin folder add a *.bbl file to your project. This file instructs the burner to exract the code out of the elf file into a newly created srecord.
I guess any bbl file you find in a existing HC08 CW project will do the job of a simple 1 to 1 code extraction.
I don't think it is possible to place the assembler generated sx file into the bin folder.
And no, I dont think absolute (ORG) code is associated with a placement, therefore the FILL wont work for absolute assembly (but, as you noted filling in abs assembly is easy without).
The compiler is not used to assemble, so compiler options will only matter if there is C/C++ code. Likewise, the assembler is not used to compile C/C++ code (there is no assemble code step for the C compiler).

Daniel
0 Kudos

770 Views
Ali2006
Contributor II
Thanks to everyone for all their assistance.
 
I've got things working now but I couldn't have done it without your help.
 
Thanks a bunch.
 
 
0 Kudos

770 Views
bigmac
Specialist III
Hello Ali2006,
 
For an absolute assembly project, it is also possible to run the assembler program as a stand-alone utility (not via the IDE).
This would avoid any ambiguity whether the linker was used or not, and whether set up parameters were applicable to the
assembler or the linker.  The debugger program can also be run stand-alone.
 
Regards,
Mac
 

Message Edited by bigmac on 2006-09-14 01:51 PM

0 Kudos

770 Views
Ali2006
Contributor II
I agree maybe using the command line would be better.. but.. I might not have that choice since the customer is always right.
 
Anyway.. with the help from CompilerGuru in filling the memory things are working pretty nicely, the only things that bug me now are these. 
 
1) The .sx file ends up in the ObjectCode folder under the Project_data folder under the Standard folder and not in the bin folder  where the listing file from the assembler ends up.   
 
2) The S19 file as we all used to call it is now called an .sx file.. Why to they keep changing these things?
 
Anyway.. Does anyone know how to get the .sx file output from the assembler using absolute assembly  to end up in the bin folder, compiling in the IDE?   
 
Thanks again for all your assistance.
0 Kudos