Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-12

arm-embedded and interrupts

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

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

Jeppe Græsdal Johansen
to Koenraad Lelong
Koenraad Lelong wrote 26 lines
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.

Koenraad Lelong
to Jeppe Græsdal Johansen
Jeppe Græsdal Johansen wrote 19 lines
> > 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.

Thanks,

That works. I already found the names, but I didn't know how to declare the interrupts, so now I do.
I hope to do some real work in the next few weeks.

Regards,

Koenraad Lelong