lpcware

Interrupt Handlers in Ram (lpc1114)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ArtjomGromak on Mon Sep 10 13:36:00 MST 2012
Hi.
I try place Systick_Handler in Ram and program .don't work.
Program text:

#include "lpc11xx.h"
#include <core_cm0.h>

extern "C" void SystemTimer_ISR(void);

volatile uint_fast32_t SysTickWas;
__attribute__ ((__section__(".ramfunc")))
void SystemTimer_ISR()
{
SysTickWas=1;
}

int main()
{
LPC_GPIO0->DIR=(1<<7);
LPC_GPIO0->DATA=0;
uint16_t tick_counter=0;
SysTick_Config(48000);
while (1) {
if (SysTickWas) {
SysTickWas=0;
uint16_t tick_limit = (LPC_GPIO0->DATA&(1<<7)) ? (30) : (970);
if (++tick_counter>=tick_limit) {
tick_counter=0;
LPC_GPIO0->DATA^=(1<<7);
}
}
}
}


ramfunc-section(from LPC1114_3xx.ld)

.ramfunc :
    {
        . = ALIGN(4);
        _sdata = .;                /* start of .data label */
        *(.ramfunc)
        *(.ramfunc.*)
    } > RAM AT > TEXT
    _sidata = LOADADDR(.ramfunc);    /* start of initialized data label */


SystemTimer_ISR (SysTick_Handler) happens 1 time and can't return to main function.
In Cortex-M3 same program work without errors.
Why it not work on Cortex-M0? What is wrong?
I use Yagarto.


Thanks.

P.S. Arcive with project: [ATTACH]835[/ATTACH]

Outcomes