Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

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

Posted by mcufan on February 21, 2014

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

Posted by rtel on February 22, 2014

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

Posted by mcufan on February 22, 2014

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 portBASETYPE), 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

Posted by mcufan on February 24, 2014

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

Posted by rtel on February 24, 2014

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

Posted by mcufan on February 24, 2014

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

Posted by hawk777 on February 26, 2014

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS