July 24, 2024, 05:48:58 AM

Serial Comunication

Started by orrr213, November 27, 2012, 12:43:27 PM

Previous topic - Next topic


good morning, 

I have a Olimex board STM32-H407, JTAG ARM-USB-OCD und OlimexODS. I want to make a serial cominication, but eclipse don`t compile my code. Below is the error message.

arm-none-eabi-as -g -mapcs-32 -o obj/startup_stm32f4xx.o ./lib/startup_stm32f4xx.s
arm-none-eabi-ld -g -v -nostartfiles -Map ./main.map -T./lib/stm32f4xx_flash.ld -o ./main.out obj/main.o obj/system_stm32f4xx.o obj/stm32f4xx_gpio.o obj/stm32f4xx_rcc.o obj/stm32f4xx_usart.o obj/comm.o obj/term_io.o obj/syscalls.o obj/stm32f4xx_it.o obj/startup_stm32f4xx.o libgcc.a
obj/main.o: In function `main':
GNU ld (Sourcery G++ Lite 2011.03-42)
C:\OlimexODS\examples\LMC/main.c:156: undefined reference to `printf'
obj/syscalls.o: In function `_kill':
C:\OlimexODS\examples\LMC/syscalls.c:29: undefined reference to `errno'
obj/syscalls.o: In function `_sbrk':
C:\OlimexODS\examples\LMC/syscalls.c:67: undefined reference to `abort'
make: *** [main.out] Error 1

I used the funtion (term_io.h, term_io.c, syscalls.c, comm.c and comm.h) of  Martin Thomas, 3BSD license
I think, the error is the Makefile but i donĀ“t know what should I do? 
Have you an example of serial comunication?
or where can the problem be?

many thanks.
With greeting


I had the same problem

I edited makefile manually
added manually the source files to makefile to linker lines

this eclipse really makes me crazy
and nobody gives a bit of information

you are all alone with yourself



What you're having problems with isn't Eclipse - eclipse is just a graphic interface to the several components of Olimex ODS. Now, ours and most other open source projects use some version of a GCC/G++ toolchain (ours is Yagarto). Compiling projects with open source tools is a lot different from compiling with a large expensive IDE like Visual Studio, etc.

You have to tell the compiler everything manually about all the files you are using - includes, dependencies, linkimg - and this is done using a Makefile (instead of writing it every time in the command-line interface). There are a lot of tricks - using default folders, wildcards etc, - but it is what it is and you should be aware of that when getting into programming with open-source tools. The GNU toolchain has very expansive documentation with everything about project management. The right makefile, one that scans whole folders and groups of files can save you a lot of time when adding/deleting files from a project.

In the Olimex ODS IDE we've provided projects with Makefiles which compile in their current state - adding/removing files and includes will most probably result in a failed compilation because the Makefile needs to be changed. An example of an exellent makefile (by Martin Thomas) is in the SAM7-EX256_cdc_FLASH project in the latest version of Olimex ODS.

Also, taking a project from the internet and just trying to compile it "as is" will almost never work - a lot of changes, rearranging of files and edits to the makefile need to be made. Yours is a linking problem - the function calls in some of your compiled .o files cannot find their target - in this case it's probably some default C libraries. In general, to use serial communication you need the peripheral libarries for your chip family, which come with example projects that can (usually) be adjusted for use with GCC ---> If you take a look at our default project for 407, It also uses the peripheral libraries but the makefile links only those currently needed - if you add the ones for serial communication to that list you should be able to use them.

In any case, I don't have enough information about this project, the files it contains or the makefile itself. Is your Eclipse project a modification of the default one we've provided or a completely new project? If you can give me more information about your files and settings and maybe a link to the resources you're using, I can take a look at it.

Best regards,

Software developer at Olimex


hello Olimex ,

I am having trouble with eclipse too
I get this error
QuoteC:\OlimexODS\examples\STM32-E407_Ethernet/ethernet.c:251: undefined reference to `_impure_ptr'

I have no such variable or function named "impure_ptr" in my whole project
I searched google without success
all I have learned is that this impure_ptr is something related to newlib
how can I get rid of this error ?