Lpcxpresso Compile Error: `.text' will not fit in region `Flash30'

cancel
Showing results for 
Search instead for 
Did you mean: 

Lpcxpresso Compile Error: `.text' will not fit in region `Flash30'

792 Views
long19890829
Contributor II

Hi ,

    I am using the NHS3100 Temperature Logger Demo, but when i add my own code in the demo program, the code size is over the flash size(30K), and the compile error is `.text' will not fit in region `Flash30'(as below).

pastedImage_2.png

I also checked the ".ld" file and the detial memory config is below:

pastedImage_1.png

I know that the flash size is only 30k to use, and a part of flash memory used to store the  temperature data, therefor, how can i solve the problem and reduce the memory size for storing the temperature data and increase the memory for code using.

      thanks!

0 Kudos
4 Replies

520 Views
driesmoors
NXP Employee
NXP Employee

Hi,

I assume you are still developing your code, and you want to free up some space while still using the Debug build configuration?

The project is a 'managed project' within the LPCXpresso IDE, which means that the makefiles will be generated for you. After building, you can find the generated makefiles within the Debug or the Release folders.

If not done already: select your project, then go to Project > Properties > C/C++ Build > Settings > Tool Settings > MCU C Compiler > Optimization. Check the selected build configuration above, and set the Optimization level for Debug to -Og.

Other gains can be made by linking the release build of the chip and the board library to your debug build of the application, or by selectively changing build optimizations for specific C files - not advised. Switching at project level to -Og is by far the easiest way, which gives quite a benefit while still allowing you to debug your code easily.

Kind regards,
Dries.

520 Views
long19890829
Contributor II
Hi Dries,
Thanks for your reply, and my problem has been solved based on your advise. BTW, did you know the NHS3100 could support the Flash-Read and Write protcetion function, I would like to put the prive key into the special flash region for the security purpose.How can I achieve this, did you have any details, Thanks again!
Kind regards,
Long.
0 Kudos

520 Views
driesmoors
NXP Employee
NXP Employee

Hi,

The FLASH does not have any read-protection feature. The IC also does not contain a secure element, so we must assume that any attacker forcing himself access to the IC (e.g. needle probing) is able to read out everything that is stored.

There are ways to mitigate the problem: ensure that the special keys are unique per IC: you can for instance base them on the unique ID of each IC. Knowledge of one IC will then not help in retrieving data from another IC.

Also, via the NFC interface, there is no direct access possible to the FLASH or the ARM EEPROM memories. Data must be requested, and that request must be handled by the ARM processor. It is thus possible to be functionally secure.

If you want, we can provide you with more information regarding how to set how a functionally secure environment, based on your use case. This is best taken offline. File a ticket in our NHS31xx support system and we'll take it from there.

Best,
Dries.

0 Kudos

520 Views
long19890829
Contributor II

Or anyone can tell me how to set the .text  sections size, and I can not find any link file in my project.  Thank your very much!!!

pastedImage_1.png

0 Kudos