Writing an ISR in pure assembly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Writing an ISR in pure assembly

Wayne Uroda-3
Hello,

I am trying to port FreeRTOS to the MSP430F5519.

In order to write the context switching part, I need to write a timer
interrupt service routine in pure assembly (the compiler right now is doing
some extra push before I can do anything in the ISR, even with nothing in
the body...)

How can I place a function (defined in an assembly file) into the vector
table?

Thanks,

- Wayne

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Writing an ISR in pure assembly

Hynek Sladky
Hi Wayne,

have You tried __attribute__ ((naked)) ? This makes function without any
push/pop... just return. Inside body use asm (" ... ");

Hynek


Dne 11.12.2013 4:48, Wayne Uroda napsal(a):

> Hello,
>
> I am trying to port FreeRTOS to the MSP430F5519.
>
> In order to write the context switching part, I need to write a timer
> interrupt service routine in pure assembly (the compiler right now is doing
> some extra push before I can do anything in the ISR, even with nothing in
> the body...)
>
> How can I place a function (defined in an assembly file) into the vector
> table?
>
> Thanks,
>
> - Wayne

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Writing an ISR in pure assembly

Wayne Uroda-3
Yes I've tried it, however on an interrupt function it seems to only do half the job!

Found something that works, putting a single branch in the ISR to a naked function. At least it seems to work for now, who knows when the compiler will decide to insert a push before my branch and break it all.

- Wayne

On 11/12/2013, at 16:29, Hynek Sladky <[hidden email]> wrote:

> Hi Wayne,
>
> have You tried __attribute__ ((naked)) ? This makes function without any push/pop... just return. Inside body use asm (" ... ");
>
> Hynek
>
>
> Dne 11.12.2013 4:48, Wayne Uroda napsal(a):
>> Hello,
>>
>> I am trying to port FreeRTOS to the MSP430F5519.
>>
>> In order to write the context switching part, I need to write a timer
>> interrupt service routine in pure assembly (the compiler right now is doing
>> some extra push before I can do anything in the ISR, even with nothing in
>> the body...)
>>
>> How can I place a function (defined in an assembly file) into the vector
>> table?
>>
>> Thanks,
>>
>> - Wayne
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Writing an ISR in pure assembly

Peter Bigot-4
In reply to this post by Wayne Uroda-3
See https://github.com/pabigot/freertos-mspgcc for FreeRTOS using MSPGCC as
of mid 2012.  The use of naked is in Source/portable/GCC/MSP430, but does
not apply to the timer ISR itself.  It was not necessary to use external
assembly sources.

http://pabigot.github.io/bsp430/freertos_8h.html may also be useful.

As I recall I did have FreeRTOS working under BSP430 and so supporting all
MCUs in the product line.  The freertos-bsp430 repository was intended to
supersede freertos-mspgcc; at this point there is no public difference,
though I seem to have some pending updates in my local workspace.  None of
that is actively supported but it could be if people find it useful.

Peter

On Tue, Dec 10, 2013 at 9:48 PM, Wayne Uroda <[hidden email]> wrote:

> Hello,
>
> I am trying to port FreeRTOS to the MSP430F5519.
>
> In order to write the context switching part, I need to write a timer
> interrupt service routine in pure assembly (the compiler right now is doing
> some extra push before I can do anything in the ISR, even with nothing in
> the body...)
>
> How can I place a function (defined in an assembly file) into the vector
> table?
>
> Thanks,
>
> - Wayne
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Writing an ISR in pure assembly

Wayne Uroda-3
Even though I think it is sorted now, I still wonder (for my own knowledge and completeness) if there is a way to either override just one of the vector positions (or is there a magic name that given to the function accomplishes the same thing) or is there a way to override all of the vector table?

I did it with the aid of nostartfiles many years ago (had need to write my own boot loader anyway) but I wonder if there is a way to do it without losing the startup routines.

- Wayne



On 11/12/2013, at 22:23, Peter Bigot <[hidden email]> wrote:

> See https://github.com/pabigot/freertos-mspgcc for FreeRTOS using MSPGCC as of mid 2012.  The use of naked is in Source/portable/GCC/MSP430, but does not apply to the timer ISR itself.  It was not necessary to use external assembly sources.
>
> http://pabigot.github.io/bsp430/freertos_8h.html may also be useful.
>
> As I recall I did have FreeRTOS working under BSP430 and so supporting all MCUs in the product line.  The freertos-bsp430 repository was intended to supersede freertos-mspgcc; at this point there is no public difference, though I seem to have some pending updates in my local workspace.  None of that is actively supported but it could be if people find it useful.
>
> Peter
>
> On Tue, Dec 10, 2013 at 9:48 PM, Wayne Uroda <[hidden email]> wrote:
>> Hello,
>>
>> I am trying to port FreeRTOS to the MSP430F5519.
>>
>> In order to write the context switching part, I need to write a timer
>> interrupt service routine in pure assembly (the compiler right now is doing
>> some extra push before I can do anything in the ISR, even with nothing in
>> the body...)
>>
>> How can I place a function (defined in an assembly file) into the vector
>> table?
>>
>> Thanks,
>>
>> - Wayne
>>
>> ------------------------------------------------------------------------------
>> Rapidly troubleshoot problems before they affect your business. Most IT
>> organizations don't have a clear picture of how application performance
>> affects their revenue. With AppDynamics, you get 100% visibility into your
>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Mspgcc-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Writing an ISR in pure assembly

Peter Bigot-4
Yes, the interrupt attribute causes the function to be named __isr_X where
X is the word offset of the interrupt from the vector table start (viz.,
the value of the attribute's parameter divided by two).  Those symbols are
used to initialize the vector table in crt0ivtbl.o.

Thus, if you're using the MSP430F5438A where USCI_A1_VECTOR is 0x5C
(decimal 92), the corresponding interrupt vector to be installed will be
__isr_46.

Due to design decisions in the distant past there's no way to use the
constants from the MCU header to automatically create the corresponding
interrupt name in an assembly file.  But you can easily use -S on a C
source file that contains an interrupt routine to see what the assembly
source needs to look like.

Peter



On Wed, Dec 11, 2013 at 4:03 PM, Wayne Uroda <[hidden email]> wrote:

> Even though I think it is sorted now, I still wonder (for my own knowledge
> and completeness) if there is a way to either override just one of the
> vector positions (or is there a magic name that given to the function
> accomplishes the same thing) or is there a way to override all of the
> vector table?
>
> I did it with the aid of nostartfiles many years ago (had need to write my
> own boot loader anyway) but I wonder if there is a way to do it without
> losing the startup routines.
>
> - Wayne
>
>
>
> On 11/12/2013, at 22:23, Peter Bigot <[hidden email]> wrote:
>
> See https://github.com/pabigot/freertos-mspgcc for FreeRTOS using MSPGCC
> as of mid 2012.  The use of naked is in Source/portable/GCC/MSP430, but
> does not apply to the timer ISR itself.  It was not necessary to use
> external assembly sources.
>
> http://pabigot.github.io/bsp430/freertos_8h.html may also be useful.
>
> As I recall I did have FreeRTOS working under BSP430 and so supporting all
> MCUs in the product line.  The freertos-bsp430 repository was intended to
> supersede freertos-mspgcc; at this point there is no public difference,
> though I seem to have some pending updates in my local workspace.  None of
> that is actively supported but it could be if people find it useful.
>
> Peter
>
> On Tue, Dec 10, 2013 at 9:48 PM, Wayne Uroda <[hidden email]> wrote:
>
>> Hello,
>>
>> I am trying to port FreeRTOS to the MSP430F5519.
>>
>> In order to write the context switching part, I need to write a timer
>> interrupt service routine in pure assembly (the compiler right now is
>> doing
>> some extra push before I can do anything in the ISR, even with nothing in
>> the body...)
>>
>> How can I place a function (defined in an assembly file) into the vector
>> table?
>>
>> Thanks,
>>
>> - Wayne
>>
>>
>> ------------------------------------------------------------------------------
>> Rapidly troubleshoot problems before they affect your business. Most IT
>> organizations don't have a clear picture of how application performance
>> affects their revenue. With AppDynamics, you get 100% visibility into your
>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
>> Pro!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Mspgcc-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>>
>>
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users