Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists