How to do multiple text segments?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by chrisz on Thu Nov 18 23:59:10 MST 2010
Just started using LPCXpresso and the Eclipse environment, so forgive me if this is somewhere in the documentation and I can't find it.

I am trying to do things:

First, whenever developing embedded systems, I always arrange Makefiles so they compile in 2 parts:

.c -> .s
.s -> .o

That way, the assembly code is always left around so I can look at it and gain an understanding of what was actually done and how to interface to it. I have found a place where I can modify the command line to gss to specify -S to get the assembly files (Tool Settings, MCU C Compiler), but I have not been successful in then making it go on to compile these generated .s files into .o files. It simply stops after the .c -> .s step and fails.

Can someone tell me how I should accomplish this? Can I use an external Makefile with the eclipse environment, and if so, can someone offer an example? The makefile in the source directory appears to be regenerated.

Second, I want to set up 2 text code segments. The first segment will go into flash. The second segment will contain init code that can be thrown away once it has run. I want to compress this segment and then load it into SRAM at startup. (I may eventually add more temporary segments using this same concept if the space saving proves substantial.)

Obviously I will need to create a custom .ld file to pass to the linker, but it is unclear how I should do this. The ones used in the example (e.g. lpcxpresso1114_blinky_Debug.ld) say that they are auto generated from nxp_lpc11_c.ld and not to modify them, but I can not find the parent file on my system.

I also need to add a step in the Makefile that strips the binary code and compresses it to a data block.

Does anyone have an example application that shows how to do this?

I'm sure I can figure all this out myself in time, but if anyone from the group can offer some assistance and an example or 2 it will save me alot of time, and having spent 2 weeks just trying to get the development system to work I'm already way behind on this project.

Thanks for any assistance.