[fpc-pascal] arm-embedded and interrupts

Jeppe Græsdal Johansen jeppe at j-software.dk
Wed Dec 11 19:36:14 CET 2013


Den 11-12-2013 19:20, Koenraad Lelong skrev:
> Hi,
>
> I made some time to tinker with my arm-embedded fpc-compiler.
> Since I had a problem in the past with routines optimized away I 
> checked for this. And indeed there is a problem : my 
> interrupt-routines are gone. How do I tell the compiler to leave those 
> routines in the binary ? I tried -O-, -O1, -O2 and -O3, all of them 
> remove 'unused' routines. When I reference the routine in the code, 
> it's in the binary. Of course that's not how it should be done.
>
> Thanks for any pointers.
> I'm using fpc 2.7.1, svn 25843.
> I declare the interrupt-routines like this :
>
> procedure SysTick_interrupt; interrupt;
>
> begin
>
> ...
> end;
>
> What am I doing wrong ?
>
> Thanks for any pointers.
>
> Koenraad Lelong
The Cortex-M RTL units were changed some time ago to favour a more 
flexible way of doing interrupt handling for embedded devices, by 
implementing assembler support for weak references and scrapping the old 
compiler integrated interrupt vector system.

Now to declare an interrupt routine you would do:

procedure SysTick_interrupt; [public, alias: 'SysTick_interrupt'];
begin
end;

You can check the source code of the RTL unit you are using to find the 
names of the interrupt handler functions.



More information about the fpc-pascal mailing list