Serial communication not working when compiling with arm-none-eabi-gcc

Hi, I have a small project for an LPC2138 MCU that uses FreeRTOS and reads/writes to UART0 and UART1. Everything was working fine when I compiled it on Windows with arm-elf-gcc. However I moved to a new computer that has Ubuntu. Now I am compiling with arm-none-eabi-gcc 4.8.3 20131129 (http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ precise/main amd64 Packages). The problem is that it seems UART interrupts has stopped working. When I compile the very same code (I modified only the compiler in Makefile) with arm-elf-gcc, it works perfectly. Unfortunately there is no arm-elf-gcc package available for Ubuntu, so I could not try it with that. Is there something else I should have modified or is this a compiler bug? Best regards, mcufan

Serial communication not working when compiling with arm-none-eabi-gcc

Sorry – this is a FreeRTOS forum, not a LPC2138 or GCC forum, all I can suggest is you look at the output generated by the compiler in both cases to see what is different. It could be something is being optimised away by one compiler and not the other because there is a volatile missing or some such thing. Regards.

Serial communication not working when compiling with arm-none-eabi-gcc

I compared the assembly code generated by the compilers and it seems that the arm-none-eabi-gcc 4.8.3 generated code subtracts 12 instead of 8 from the stack pointer when it enters the vUARTISRHandler called from vUARTISRWrapper. Most probably this happens due to the __asm volatile (“bl vUARTISRHandler”) function call. However since there are only two variables defined in vUARTISRHandler (char and portBASE_TYPE), there should really be 8 bytes on the stack. I’ll file a bug report to gcc. Thank you for the help!

Serial communication not working when compiling with arm-none-eabi-gcc

As I learned this is not a bug in the compiler. The problem is that arm-elf and arm-none-eabi are different binary interfaces, so for example the function calls are different. Unfortunately it seems that ARM7LPC2106GCC demo can be compiled only with arm-elf-gcc. Most probably ASM parts of the interrupt handlers are written in a way that it is compatible with only the arm-elf binary interface. Is it possible to provide a similar example for the arm-none-eabi-gcc compiler in the FreeRTOS demo package? I am asking this because it seems arm-elf is deprecated and arm-none-eabi is used lately. For most distributions eg. 4.6.x arm-elf-gcc compiler is no longer available, only arm-none-eabi-gcc. Thanks, mcufan

Serial communication not working when compiling with arm-none-eabi-gcc

I’m not sure the asm itself would cause an issue as the asm is used to prevent the compiler inserting anything. Without looking at the code (which I can’t do right now) I can’t be sure though. It is unlikely such an old demo would get an update as the majority of new users use the Cortex parts which don’t need any special interrupt entry code and we have to prioritise work there. Regards.

Serial communication not working when compiling with arm-none-eabi-gcc

You are right, it has nothing to do with the asm wrapper. The problem seems to be that vUARTISRWrapper does not even get called. Unfortunately I do not have access to a debugger, I could just figure out from flashing leds and checking the generated asm code of xSerialPortInit that the VIC vector address is set correctly, divisor is ok, fifo is set, interrupts are enabled… But still the interrupt wrapper code never gets called when arm-none-eabi-gcc compiler is used.

Serial communication not working when compiling with arm-none-eabi-gcc

This doesn’t seem really FreeRTOS related, but if the UART isn’t entered, perhaps it’s not the change of compilers but rather the change of libraries that causes the problem—have you verified that a pointer to your ISR is still being stored in the vector table? An objdump should let you check that easily enough.