Quality RTOS & Embedded Software

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


Loading

porting from IAR to GCC STR91x

Posted by Fabrizio on October 16, 2006
Hi,
I've a problem with the functions vPortDisableInterruptFromThumb and vPortEnableInterruptFromThumb.
In IAR arm7 (AT91SAM7S) the function are defined in portmacro.h as:
__arm __interwork void vPortDisableInterruptsFromThumb( void );
__arm __interwork void
vPortEnableInterruptsFromThumb( void );
They are been ported in gcc in the file portISR.c as follows:
void vPortDisableInterruptsFromThumb( void ) __attribute__ ((naked));
void vPortEnableInterruptsFromThumb( void ) __attribute__ ((naked));

void vPortDisableInterruptsFromThumb( void )
{
asm volatile (
"STMDBSP!, {R0}\n\t"/* Push R0.*/
"MRSR0, CPSR\n\t"/* Get CPSR.*/
"ORRR0, R0, #0xC0\n\t"/* Disable IRQ, FIQ.*/
"MSRCPSR, R0\n\t"/* Write back modified value.*/
"LDMIASP!, {R0}\n\t"/* Pop R0.*/
"BXR14" );/* Return back to thumb.*/
}

void vPortEnableInterruptsFromThumb( void )
{
asm volatile (
"STMDBSP!, {R0}\n\t"/* Push R0.*/
"MRSR0, CPSR\n\t"/* Get CPSR.*/
"BICR0, R0, #0xC0\n\t"/* Enable IRQ, FIQ.*/
"MSRCPSR, R0\n\t"/* Write back modified value.*/
"LDMIASP!, {R0}\n\t"/* Pop R0.*/
"BXR14" );/* Return back to thumb.*/
}
In IAR STR91x portmacro.h file, i don't have these functions but i've only two defines:
#define portDISABLE_INTERRUPTS()__disable_interrupt()
#define portENABLE_INTERRUPTS()__enable_interrupt()
My question is: How can i port these function in portISR.c in GCC STR91x file?

Thanks.

Fabrizio.

RE: porting from IAR to GCC STR91x

Posted by Nobody/Anonymous on October 17, 2006
First, you may find it easier to take an existing CrossWorks ARM7 demo, and retarget it at the STR9. Although internally there are many differences between the ARM7 and ARM9 from the programmer view point they are very similar, so probably only the timer set and memory map will be very different to the existing ARM7 demo. The ARM7 demos use a different interrupt entering mechanism than the ARM9 demo, but this is only a matter of taste.

Now to your question.

I think you can simply replace the __disable_interrupt() with libarm_disable_irq(). Lookup libarm_disable_irq() in the CrossWorks docs.

The FreeRTOS project uses the same port files as the vanilla GCC project, hence the CrossWorks extensions such as libarm_disable_irq() are not used as they would not compile with vanilla GCC.


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


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

Latest News

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner