How to get console output while debugging nhs31xx project?

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

How to get console output while debugging nhs31xx project?

961 Views
yys3210
Contributor II

Hi Sir
I am woking on NHS3152+LPCXpresso, the demo project is "app_demo_dp_tlogger". there is no problem.
Then i want to test the function "printf",I set the project to "。。。managed linker script--library: redlib(semihost)"
At the beginning there is no "printf" statement in the project ,
1, the project set active to "release" mode, it build well.
2, the project set active to "debug" mode ,there is an error , it shows as below
"c:/nxp/lpcxpresso_8.2.0_647/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find -llib_chip_nss
collect2.exe: error: ld returned 1 exit status"
I need your help
Many thanks

Labels (1)
3 Replies

795 Views
yys3210
Contributor II

I am sorry.my computter  halted down for days. when i reimported the original project about nhs31xx/tlogger. i have checked the setting carefully:
mcu settings is "NHS3152";
projet/set active choose "debug";
the Linker script item choose "redlib(semihost)";
setting--tool settings--optimization choose "-Og".(other optimization flags remains "-fno-common")


step 1; build the project in debug mode ,well done
step 2: only add a statement " printf("this is a test...\n");" in function main() of the source file "maintloger.c "
build debug again,there is an NEW error message , it shows as below
"../arm-none-eabi/bin/ld.exe: app_demo_dp_tlogger.axf section `.text' will not fit in region `Flash30'
../arm-none-eabi/bin/ld.exe: region `Flash30' overflowed by 1396 bytes"

by the way ,i have readed the discussion about "Lpcxpresso Compile Error: `.text' will not fit in region `Flash30'" https://community.nxp.com/thread/464995"
i need your very help, thank you!

0 Kudos

795 Views
converse
Senior Contributor V

Using printf with the redlib semihost is a large library - therefore, your use of it is overflowing the amount of flash in your device. There are some tips in this article on how to reduce the size of the library:

Using printf() 

However, it could be that you really do not have enough space to be able to do this. In which case you may just want to use puts() to put fixed strings (with no formatting allowed).

795 Views
driesmoors
NXP Employee
NXP Employee

Hi,

You changed the option Library under Project > Properties > C/C++ Build > Settings > Tool Settings> MCU Linker > Managed Linker script just fine.

Just a hunch: could it be you changed the option only for the release build configuration? On top of the properties dialog, you can select the build configuration for which to change the settings for. This means you have to make the changes twice: once for Debug, once for Release.

Let me know if this was the cause!

Another remark: this printf requires an active debugger connection. Executing the code without a debugger session active will halt the IC. When using the tlogger demo application you can avoid that by defining APP_MAINTAIN_SWD_CONNECTION - see maintlogger.c near the top of the file.

Best,
Dries.

0 Kudos