LPC812: Code size too large

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

LPC812: Code size too large

1,358 Views
fjrg76
Contributor IV

Hi, while working with the LPCXpresso 812MAX I observed that the code produced for the blinky project is 5532 bytes, too mucho for such a small project (with no optimization at all), but the Board and Chip libraries are set to -Os because no one is going to debug any of them. Is that figure normal for that project?

153999_153999.pngCaptura de pantalla de 2016-06-20 22_56_05.png

Labels (1)
Tags (2)
0 Kudos
5 Replies

711 Views
rianzu
Contributor II

1. Look into your *.map file and see exactly what symbols occupies .text and how big they are.

2. Link with NewLib (nano) and don't use float options.

3. Use -Os for entire project but with care (force some drivers with -O0)

Original drivers are buggy and linking with -Os sometimes will provide unexpected results. Also some of them are completely un-optimized for small embedded so indeed, will produce a lot of code, consuming both PGM and performances.

711 Views
lpcxpresso_supp
NXP Employee
NXP Employee

By default, most LPCOpen provided examples build against the "Redlib (Nohost)" variant of the C library - which is needed if the code is doing a printf, but is otherwise not needed. Try switching the C library being linked against to "Redlib (None)".

Switching the selected C library

This will typically reduce flash/ram requirements noticeably.

I would also suggest reading:

Application Flash / RAM size

Looking at the map file should give you a good idea of what is actually being pulled into your linked image.

Regards,

LPCXpresso Support

711 Views
avt
Contributor III

The point of the examples is not to produce the smallest possible example, but to show you how to use the chip, and the LPCOpen libs and to do it in an understandable way. The libraries include code that is not strictly needed by a blinky, but will be used in a more practical application.

If you want to find a small blinky, search these forums - I seem to remember a 'competition' a couple of years ago, that had the blinky down to a hundred bytes or so.

0 Kudos

711 Views
avt
Contributor III

Here is the thread for a minimal blinky:

https://community.nxp.com/message/772566#comment-772566

0 Kudos

711 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

Regarding to the statement above, the image file is contained many object files which definitely increase its size.

You shall remove the corresponding head files in the chip.h, it can reduce the size by through the approach.

2016-07-27_11-25-59.jpg


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos