The example of ADC does not work in Linux

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

The example of ADC does not work in Linux

536 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Fri Oct 08 12:50:43 MST 2010
Hello CodeRed,

The example of ADC does not work, I think the problem is that "printf" does not print.

In Windows it works.
[COLOR=#000000]Any quick way to fix the library/example?[/COLOR]

Also, have not yet fixed a bug that is almost a year old.:
http://knowledgebase.nxp.com/showthread.php?t=49

Thank you.
0 Kudos
8 Replies

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Thu Oct 28 06:19:27 MST 2010

Quote: CodeRedSupport
Under Linux you may need to enable semihosting in the debugger:

[LIST]
[*]right-click on the project and select Launch configurations-.Open current launch configuration
[*]in the dialog, switch to the Debugger tab
[*]in the Script Values list, change "Semihosting support" to on
[/LIST]
Now start your debug session again, and you should see the output.



It works.  Thank you for the support, this will make debugging a lot easier :)
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Oct 28 06:03:52 MST 2010
Under Linux you may need to enable semihosting in the debugger:

[LIST]
[*]right-click on the project and select Launch configurations-.Open current launch configuration
[*]in the dialog, switch to the Debugger tab
[*]in the Script Values list, change "Semihosting support" to on
[/LIST]
Now start your debug session again, and you should see the output.
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Oct 28 05:50:57 MST 2010

Quote:

make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size adc.axf; # arm-none-eabi-objcopy -O ihex adc.axf adc.hex ;
   text       data        bss        dec        hex    filename
   9096          4         44       9144       23b8    adc.axf



Is not an error. It is an option to 'make' that tells it not to print a change of directory. There are NO errors in the output that you have posted.
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Thu Oct 28 05:22:56 MST 2010

Quote: CodeRedSupport
I'm sorry, but you have not provided enough information to be able to help you:
- What does "compiles fine - though it says no print directory" mean? What is the actual text of any error message
- have you added any printf/consoleprint calls in your application? It might be easier if you exported and posted the whole project: http://support.code-red-tech.com/CodeRedWiki/ImportExport




This is the output i get from my console when i build the program - notice the last set of text.
**** Clean-only build of configuration Debug for project adc ****

make clean 
rm -rf  ./src/adc.o ./src/adc_main.o ./src/cr_startup_lpc13.o  ./src/adc.d ./src/adc_main.d ./src/cr_startup_lpc13.d  adc.axf
 

**** Build of configuration Debug for project adc ****

make all 
Building file: ../src/adc.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__USE_CMSIS=CMSISv1p30_LPC13xx -DCR_INTEGER_PRINTF -DDEBUG -D__CODE_RED -D__REDLIB__ -I"/home/samantha/workspace/CMSISv1p30_LPC13xx/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/adc.d" -MT"src/adc.d" -o"src/adc.o" "../src/adc.c"
Finished building: ../src/adc.c
 
Building file: ../src/adc_main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__USE_CMSIS=CMSISv1p30_LPC13xx -DCR_INTEGER_PRINTF -DDEBUG -D__CODE_RED -D__REDLIB__ -I"/home/samantha/workspace/CMSISv1p30_LPC13xx/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/adc_main.d" -MT"src/adc_main.d" -o"src/adc_main.o" "../src/adc_main.c"
Finished building: ../src/adc_main.c
 
Building file: ../src/cr_startup_lpc13.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__USE_CMSIS=CMSISv1p30_LPC13xx -DCR_INTEGER_PRINTF -DDEBUG -D__CODE_RED -D__REDLIB__ -I"/home/samantha/workspace/CMSISv1p30_LPC13xx/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/cr_startup_lpc13.d" -MT"src/cr_startup_lpc13.d" -o"src/cr_startup_lpc13.o" "../src/cr_startup_lpc13.c"
Finished building: ../src/cr_startup_lpc13.c
 
Building target: adc.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"/home/samantha/workspace/CMSISv1p30_LPC13xx/Debug" -Xlinker --gc-sections -Xlinker -Map=adc.map -mcpu=cortex-m3 -mthumb -T "adc_Debug.ld" -o"adc.axf"  ./src/adc.o ./src/adc_main.o ./src/cr_startup_lpc13.o   -lCMSISv1p30_LPC13xx
Finished building target: adc.axf
 
make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size adc.axf; # arm-none-eabi-objcopy -O ihex adc.axf adc.hex ;
   text   data    bss    dec    hexfilename
   9096      4     44   9144   23b8adc.axf
 


I cut and pasted this project from your examples and made the following changes:
#define ADC_INTERRUPT_FLAG0/* 1 is interrupt driven, 0 is polling */
#define ADC_DEBUG1


I took out the comment codes in front of printf in adc_main.c :
#ifdef ADC_DEBUG
// Note: a single printf call can add 10k to code size
ADCBar(i, ADCValue);
printf("ADC[%d] = %05d\r\n", i, ADCValue);
#endif


i attached my export.  thanks!
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Oct 28 04:44:05 MST 2010
I'm sorry, but you have not provided enough information to be able to help you:
- What does "compiles fine - though it says no print directory" mean? What is the actual text of any error message
- have you added any printf/consoleprint calls in your application? It might be easier if you exported and posted the whole project: http://support.code-red-tech.com/CodeRedWiki/ImportExport
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Thu Oct 28 04:27:23 MST 2010
I've changed ADC_BASE and selected semihosting for my build option(compiles fine - though it says no print directory) but i can't see anything in my console window when i debug the program.

Are there additional things you need to do or run the program in a certain way?

thanks,
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Oct 11 01:20:14 MST 2010
Looking at the LPC13 adc project supplied with the current LPCXpresso for Linux beta, it is using "old" startup code. If you replace the startup code with the code produced by the new project wizard, then you should find that the printf's will then write out to the console. For more information, please see the FAQ:

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

I'll pass this information on to NXP for fixing in a future drop of their lpcxpresso examples (along with the need to fix ADC_BASE -> LPC_ADC_BASE), as well as double-checking the CodeRed produced examples.

[Aside - The fact that you got things working by pulling in consoleprint() is due to it setting a symbol that is picked up by the debugging when loading an image, which then enables semihosting support in the debugger. However although your semihosting output then appears in the console, there are potentially other issues that would not be fixed.]

Regards,
CodeRedSupport.
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Sat Oct 09 07:47:24 MST 2010
I added the files "Consoleprint.h" and "Consoleprint.c" within the ADC project, and now "printf" work.

I also added "consoleprint("\n");" in the Main Function.
0 Kudos