Arm cortex m3

Discussion in 'Embedded Systems and Microcontrollers' started by embed_v, Dec 1, 2010.

  1. embed_v

    Thread Starter New Member

    Aug 30, 2010
    24
    0
    we are using ti cortex m3 uc. keil uv 4.03
    i want to implement a bootloader so that the bootloader will the apllication ie my main function.
    but i was wrote the code for resetisr handler (i am usign rvmdk).
    i get error like :
    call.c(150): error: #1113: Inline assembler not permitted when generating Thumb code

    // #include"uart0.h"
    //*****************************************************************************
    //
    // Forward declaration of the default fault handlers.
    //
    //*****************************************************************************
    void ResetISR(void);
    static void NmiSR(void);
    static void FaultISR(void);
    static void IntDefaultHandler(void);

    // The entry point for the application.
    (is it right)
    #if defined ( __CC_ARM )
    #define __ASM __asm /*!< asm keyword for ARM Compiler */
    #define __INLINE__inline /*!< inline keyword for ARM Compiler */




    //
    // External declaration for the interrupt handler used by the application.
    //

    __irq void UART0_ISR(void);



    // The entry point for the application.

    //extern int main(void);


    #ifndef STACK_SIZE
    #define STACK_SIZE 64
    #endif
    static unsigned long pulStack[STACK_SIZE];


    extern unsigned long _vStackTop;


    extern unsigned long _etext;
    extern unsigned long _data;
    extern unsigned long _edata;
    extern unsigned long _bss;
    extern unsigned long _ebss;

    __attribute__ ((section(".isr_vector")))
    void (* const g_pfnVectors[])(void) =
    {
    (void (*)(void))((unsigned long)&_vStackTop),
    // The initial stack pointer
    ResetISR, // The reset handler
    NmiSR, // The NMI handler
    FaultISR, // The hard fault handler
    IntDefaultHandler, // The MPU fault handler
    IntDefaultHandler, // The bus fault handler
    IntDefaultHandler, // The usage fault handler
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // SVCall handler
    IntDefaultHandler, // Debug monitor handler
    0, // Reserved
    IntDefaultHandler, // The PendSV handler
    IntDefaultHandler, // The SysTick handler
    IntDefaultHandler, // GPIO Port A
    IntDefaultHandler, // GPIO Port B
    IntDefaultHandler, // GPIO Port C
    IntDefaultHandler, // GPIO Port D
    IntDefaultHandler, // GPIO Port E
    IntDefaultHandler, // UART0 Rx and Tx
    IntDefaultHandler, // UART1 Rx and Tx
    IntDefaultHandler, // SSI0 Rx and Tx
    IntDefaultHandler, // I2C0 Master and Slave
    IntDefaultHandler, // PWM Fault
    IntDefaultHandler, // PWM Generator 0
    IntDefaultHandler, // PWM Generator 1
    IntDefaultHandler, // PWM Generator 2
    IntDefaultHandler, // Quadrature Encoder 0
    IntDefaultHandler, // ADC Sequence 0
    IntDefaultHandler, // ADC Sequence 1
    IntDefaultHandler, // ADC Sequence 2
    IntDefaultHandler, // ADC Sequence 3
    IntDefaultHandler, // Watchdog timer
    IntDefaultHandler, // Timer 0 subtimer A
    IntDefaultHandler, // Timer 0 subtimer B
    IntDefaultHandler, // Timer 1 subtimer A
    IntDefaultHandler, // Timer 1 subtimer B
    IntDefaultHandler, // Timer 2 subtimer A
    IntDefaultHandler, // Timer 2 subtimer B
    IntDefaultHandler, // Analog Comparator 0
    IntDefaultHandler, // Analog Comparator 1
    IntDefaultHandler, // Analog Comparator 2
    IntDefaultHandler, // System Control (PLL, OSC, BO)
    IntDefaultHandler // FLASH Control
    };

    void ResetISR(void)
    {
    unsigned long *pulSrc, *pulDest;

    //
    // Copy the data segment initializers from flash to SRAM.
    //
    pulSrc = &_etext;
    for(pulDest = &_data; pulDest < &_edata; )
    {
    *pulDest++ = *pulSrc++;
    }

    //
    // Zero fill the bss segment.
    //
    __asm(" ldr r0, =_bss\n" <===(here i get err)
    " ldr r1, =_ebss\n"
    " mov r2, #0\n"
    " .thumb_func\n"
    "zero_loop:\n"
    " cmp r0, r1\n"
    " it lt\n"
    " strlt r2, [r0], #4\n"
    " blt zero_loop");

    //
    // Call the application's entry point.
    //


    main();

    }

    static void NmiSR(void)
    {
    //
    // Enter an infinite loop.
    //
    while(1)
    {
    }
    }


    static void FaultISR(void)
    {
    //
    // Enter an infinite loop.
    //
    while(1)
    {
    }
    }


    static void IntDefaultHandler(void)
    {
    //
    // Go into an infinite loop.
    //
    while(1)
    {
    }
    }
    exactly which segments ie bss, data segments are used in real view compiler.
    what i done is is rt?
     
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    It is EXACTLY as the error says. You are mixing languages.

    That complier does not allow ASM while using the Thumb instruction set.

    You are going to have to change compilers (hard) or re write the ASM section in non-ASM Thumb usable code.
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I found This thread

    Essentially, you cannot inline assembly in the same file when compiling for THUMB. The assembly needs to be compiled as an .asm file on its own, and linked at build time.

    From the link above:
     
Loading...