LPCXpresso vs Keil

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

LPCXpresso vs Keil

730 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by borik2003 on Thu Nov 11 07:20:09 MST 2010
Very strange

if i add sqrt() function in LPCXpresso in any example code

let say sqrt(7); this line adds almost 3k byte to the .text

but in keil same function only 0.5k

Both in Release mode.

How do you explain that ?
0 Kudos
8 Replies

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Mon Nov 15 16:44:11 MST 2010
You may also find this useful:

"AN10963 Reducing code size for LPC11XX with LPCXpresso"
http://ics.nxp.com/support/documents/microcontrollers/zip/an10963.zip
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 15 09:08:18 MST 2010

Quote: borik2003
Last think , in  mass production stage what a best way to born a assmbled
boards ?  ISP or IAP or SWD ?

Do you have some utility with your Software packet that can be used for
mass production programming ?



LPCXpresso does include a command line utility for programming the flash. We are certainly aware of quite a few customers using this for production programming. You can find some information on using this at:

http://support.code-red-tech.com/CodeRedWiki/CommandLineFlashProgramming

You might get more feedback from the general community on the various approaches to production flash programming by creating a new forum thread specifically about this.

Regards,
CodeRedSupport
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by borik2003 on Mon Nov 15 07:21:56 MST 2010
Ok i get it.

In general we want to move from 8051 to some low cost\low power ARM
processor and one of the main things to check is - a suitble compiler.

At this stage (when we will check the ARM Core capabilites) the LPCXpresso is seems to be good, but for long therm when the application code will be more complicated we do not want to find out that we actualy using not so good optimized compiler and will need rewite the already existing code .

I hope when we will finish to evaluating the new MCU (NXP LPC1114) you will
be ready with a  new version of compiler :).

Last think , in  mass production stage what a best way to born a assmbled
boards ?  ISP or IAP or SWD ?

Do you have some utility with your Software packet that can be used for
mass production programming ?

Thanks for your help again.
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 15 06:57:32 MST 2010
As I previously stated, the current Windows version of LPCXpresso requires the use of the "nohost" or "semihost" version of Redlib in order to resolve errno. This causes a fair amount of code to be pulled in from the library.

The library has been restructured in LPCXpresso for Linux such that errno can be resolved with the "none" version of Redlib. This reduces the code size dramatically.....

blinky with no sqrt call
   text       data        bss        dec        hex    filename
   1052          4         24       1080        438    blinky.axf

blinky with sqrt call
   text       data        bss        dec        hex    filename
   3288          4         28       3320        cf8    blinky.axf
This compares to the numbers you quote in your PDF for building with LPCXpresso 3.5.0....

blinky with no sqrt call
   text       data        bss        dec        hex    filename
   1888          4         8       1900        76c    blinky.axf

blinky with sqrt call
   text       data        bss        dec        hex    filename
   8716        520        808      10044       273c    blinky.axf
In order to see what additional code is pulled in and from where when you change your code, you should look at the .map file that the tools automatically generate in the Debug/Release subdirectory of your project.

We hope to make this restructured version of Redlib ("Redlib_v2") available in the Windows version of LPCXpresso shortly.

One final note, I assume that you are aware that although your Keil and LPCxpresso projects are similar, they do not appear to be identical in their source code? This will have some effect on your code size that you need to take into account when comparing the output from the two toolsets.

Regards,
CodeRedSupport
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by borik2003 on Mon Nov 15 04:51:18 MST 2010
Thank for Help.

I did what you write below ,

And i have 6.8K code increasing when add sqrt() function and
onather 2k when add aditional pow() function from same math.h librery

I did compere it against Keil compiler and i get different results:

for adding sqrt() function , code increase = 560 byte
for adding pow() function , code incr. = 3.7k byte

I can't explain why there are so big differences when using standard C functions
for the same Core but with different compilers .
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 15 02:17:59 MST 2010
I'm sorry for the problems you are seeing here. A couple of points...

You appear to be using LPCXpresso 3.5.0 and basing your project on the NXP blinky project for LPC11xx. This example does not appear to be being built with unused section elimination turned on in the linker. Thus a large amount of unrequired code is not being removed during the link step.

This option will be the default in projects that you create using the project wizard and has also been fixed in the example supplied with the latest version of LPCXpresso (3.5.6). You can enable in your existing project by adding the  "[FONT=Courier New][SIZE=2]--gc-sections[/SIZE][/FONT]" sections option to the link step. To do this, go to...

[FONT=Courier New][SIZE=1]Project Properties - C/C++ Build - Settings - MCU Linker - Miscellaneous[/SIZE][/FONT]

and add the option to the "[I]Other options (-XLinker [option])[/I]" box. You can check which sections have been removed by looking at the "[I]Discarded input sections[/I]" in the linker .map file that building your project creates.

Doing this will reduce the code size of your application considerably.

[Aside - the reason why this option is not enabled in the example you are using is that some earlier versions of LPCXpresso had problems with some debug operations when this was enabled, hence some examples had the option turned off. However these debug-related issues are now fixed, but unfortunately this particular example did not get the option added back in until the latest release.]

With regards to sqrt(),  a couple of things are causing your code size increase. First of all, the code for sqrt() requires access to various divide functions to be pulled in. These divide functions are often pulled in by either user code or other C library functions, but the example that you modified did not previously require them - thus you saw a larger code size increase than I did in my test case, which did already pull them in.

Secondly, as you saw, if you use a library function that requires access to the C library errno variable, this requires you to link with either the nohost or semihost variants of the C library. I'm sorry that it took you some time to discover this, though there is an FAQ that covers this:

http://support.code-red-tech.com/CodeRedWiki/UndefinedReference

And linking with nohost/semihost redlib variants does cause some additional code to be pulled in.

Note that is future version of the tools, this requirement to link with the nohost/semihost redlib variants to access errno has been removed. A version of Redlib without this requirement is already provided in LPCXpresso for Linux, and we hope to roll it out into the Windows version shortly.

Regards,
CodeRedSupport
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by borik2003 on Sat Nov 13 23:55:19 MST 2010
Attached below steps i did.
0 Kudos

619 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Nov 11 08:13:51 MST 2010
I see ~300 bytes being added from adding a call to sqrt(), so there is obviously something more to what you are seeing.

I would suggest posting example code that when built shows up the code size increases you are seeing. Please provide both the sqrt() using and non-using versions of your code.

Regards,
CodeRedSupport
0 Kudos