Force Files into specific memory location

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

Force Files into specific memory location

Jump to solution
879 Views
ignisuti_
Contributor IV

I'm creating a bootloader and want to force an entire file into a specific memory section defined in my linker configuration script. I was able to do this before with the older CodeWarrior compiler, but looks like GCC handles this differently.

 

Before, I simply listed the filename.o along with the Section in my linker configuration file, but when I try that now, CW10.6 gives an error indicating that it cannot find the object file. I looked in the project properties, but it did not appear to me where I could define the object file's location so the linker would find it.

 

Please help.

Labels (1)
0 Kudos
1 Solution
661 Views
BlackNight
NXP Employee
NXP Employee

Hi Joe,

I have published an article how I do this with GNU here:

Putting Code of Files into Special Section with the GNU Linker

I hope this helps,

Erich

View solution in original post

0 Kudos
6 Replies
662 Views
BlackNight
NXP Employee
NXP Employee

Hi Joe,

I have published an article how I do this with GNU here:

Putting Code of Files into Special Section with the GNU Linker

I hope this helps,

Erich

0 Kudos
661 Views
ignisuti_
Contributor IV

Erich,

That article was great and got me most of the way there. I really like that you've shown how to specify an entire folder.

I also want to force the standard C files into a specific section, much like Ming Jiang who commented on your post. I see you suggested rebuilding the library. Can you please elaborate on what you mean by that? I interpret that as suggestion I look at the __aeabi_frsub function and determine which standard C file it's in, then add that file to my project. If that's the case, how would I tell the compiler to use my file and not the precompiled versions?

Also, sorry for the late reply. Is there a way to get notified via email when someone responds to your post? That's one feature I greatly miss in this forum. I am following this stream (along with others), but never see an email.

0 Kudos
661 Views
BlackNight
NXP Employee
NXP Employee

Hi Joe,

if you re-build the library, you can select the files you want to have them included, and you can have them in dedicated folders. That way you can place them easily into dedicated code section. Basically it means that you build your own custom version of the library.

As for your question about email notifications: I get them (that's why I know you posted someting to that thread :-). Maybe check your email filter/firewall, or check the settings of your user account in this forum (email address, etc)?

I hope this helps,

Erich

0 Kudos
661 Views
ignisuti_
Contributor IV

Erich,

I'm still not following what you mean when you say "re-build the library". Did I describe that process as you're expecting in my last email? Or, are you thinking of something else? If you're talking about Processor Expert, I've always rolled my own and therefore do not use that tool.

You're right on the email thing. It looks like that particular email address is no longer active...

0 Kudos
661 Views
BlackNight
NXP Employee
NXP Employee

Hi Joe,

I'm sorry that I was not clear. You need to be able to identify the file name/object file name so you can use it in your linker script, as explained in that post. I have not done that with a library file itself, but I think that will work too.

What I have done in the past is to rebuild the GNU libraries (http://mcuoneclipse.com/2014/08/23/gnu-libs-with-debug-information-rebuilding-the-gnu-arm-libraries/​, but this does not work out of the box on Windows, so this approach might be too heavy for you.

The approach you describe should work too, I'm only affraid that compiling that single file might require that you have other files present/etc. But why not giving it a try?

I hope this helps,

Erich

0 Kudos
661 Views
ignisuti_
Contributor IV

Erich,

I've been playing with many variations in order to identify the file name/object via the linker configuration. I've tried adding the library and object files to my project and specifying those in the linker configuration. However, it appears the library located at

"C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libc.a" appears to be taking precedence without getting relocated to the section I'm specifying. I've tried to call out that library specifically, but doesn't appear that the linker lets you call out library files. I feel I'm close and there's something very small I'm missing here. If you have any further suggestions. Please let me know.

An alternative that I'm considering is updating the linker file to locate ALL code into the Bootloader section unless I re-direct it. So, in this case, I'd have an "App" folder and all code in there would be redirected to the Application section. This is a little backwards from what I was after, but I believe it'll accomplish the same goal and actually have a nice benefit of being a catch-all in the sense that there no way to accidentally forget to include something in the Bootloader.

0 Kudos