S-Record output size

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

S-Record output size

Jump to solution
1,475 Views
ahmedfouda
Contributor I

Hi,

 

I'm trying to build my application using CodeWarrior.

 

I don't have an entry function to my software so that I set INIT to entry in my prm file, where entry is an empty function.

When I do this, the resulting map file doesn't contain any of the functions in my software.

 

I searched for this problem and I used the NAME .. END option in the prm file to include all objects in my *.o files.

Now the generated map file includes all functions, but the .sx file is very small to include the code of the functions. (It's just one line of HEX)

 

Do you have any solution for this.??

Labels (1)
Tags (1)
0 Kudos
1 Solution
592 Views
CompilerGuru
NXP Employee
NXP Employee

The linker only actually allocates functions which are referred, typically by starting at _Startup and then main.

So everything called by main gets allocated. If your main/_Startup do not actually use your objects, then they do not get allocated.

I guess you have some vector table which contains function pointer to all interrupt handlers (or some other kind of how your code/data gets referred to). Add that object into a ENTRIES XXX END block so it becomes an additional root for the linker.

 

Daniel

View solution in original post

0 Kudos
5 Replies
593 Views
CompilerGuru
NXP Employee
NXP Employee

The linker only actually allocates functions which are referred, typically by starting at _Startup and then main.

So everything called by main gets allocated. If your main/_Startup do not actually use your objects, then they do not get allocated.

I guess you have some vector table which contains function pointer to all interrupt handlers (or some other kind of how your code/data gets referred to). Add that object into a ENTRIES XXX END block so it becomes an additional root for the linker.

 

Daniel

0 Kudos
592 Views
Lundin
Senior Contributor IV

> I don't have an entry function to my software

 

You must have one, obviously, or the program wouldn't make any sense.

 

By default in CW, the entry function is main() for C programs. If you write assembler you must use the INIT syntax as you describe. Alternatively you can also define one of your own by writing your own reset ISR if you wish.

 

> so that I set INIT to entry in my prm file, where entry is an empty function.

 

Why would you use an empty function for? Don't you want your program to do anything?

 

 NAMES... END shouldn't be necessary. If you want to force linking of your functions or variables, their names should be placed inside ENTRIES... END.

0 Kudos
592 Views
ahmedfouda
Contributor I

Hi,

 

I don't need an entry function because I compile this code just to get the HEx output and then put this hex output in memory and access it by pointers.

So I'm sure that i don't need entry.

 

I tried to use ENTRIES .. END, but the resulting .sx file doesn't contain any code.

0 Kudos
592 Views
CompilerGuru
NXP Employee
NXP Employee

According to the map file, are your functions linked or not (do they have an address?)?

If not, then I would still think ENTRIES is the way to go.

If they are linked, check how the srecord gets generated. And that you look at the right srecord file.

 

Daniel

0 Kudos
592 Views
ahmedfouda
Contributor I

Hi,

 

Thanks, It's working now usint ENTRIES XXX END

 

0 Kudos