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).
I also checked the ".ld" file and the detial memory config is below:
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.
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.
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.