comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Protected Objects and Interrupt Handlers
Date: Sun, 13 Mar 2016 08:10:46 +0000
Date: 2016-03-13T08:10:46+00:00	[thread overview]
Message-ID: <lyvb4qztkp.fsf@pushface.org> (raw)
In-Reply-To: lybn74o9i0.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

> Tero Koskinen <tero.koskinen@iki.fi> writes:
>
>> For example in the normal case, you can have all the startup code in C
>> (or in Ada, which is then exported to C)
>
> Actually, very little even needs exporting to C! I had one that I've
> given convention Asm (it's invoked by the linker script), but I'm not at
> all sure it needs it.
>
> Mind you,
>
>    procedure Program_Initialization
>    with
>      Export,
>      Convention => Asm,
>      External_Name => "program_initialization",
>      No_Return;
>    pragma Machine_Attribute (Program_Initialization, "naked");
>
>    procedure Program_Initialization is
>    begin
>       --  _estack: the first address after the top of stack space
>       System.Machine_Code.Asm ("ldr sp, =_estack", Volatile => True);
>       Complete_Program_Initialization;
>    end Program_Initialization;
>
> probably isn't going to cause much trouble anyway.

The thinking behind that little bit of asm was that the SAM3X8E has a
bootstrap loader in (a separate section of) FLASH, and a reset mode that
uses it, and you can mistakenly leave the MCU in bootstrap mode, and thi
should recover it .. but I'm now pretty sure it desn't.

Corrent work, on STM32F429I, manages an Ada startup with two assembler
instructions (dsb, isb to flush the caches after enabling the FPU).

      reply	other threads:[~2016-03-13  8:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23 22:25 Protected Objects and Interrupt Handlers Jere
2016-02-23 23:09 ` Simon Wright
2016-02-24 14:38   ` Jere
2016-02-24 18:29     ` Simon Wright
2016-02-24 21:37       ` Jere
2016-02-25 15:14 ` Maciej Sobczak
2016-02-25 15:59   ` Simon Wright
2016-02-26  3:20     ` Dennis Lee Bieber
2016-02-26  8:12       ` Simon Wright
2016-02-27 18:06     ` Maciej Sobczak
2016-02-25 16:02   ` Simon Wright
2016-02-25 17:40     ` Tero Koskinen
2016-02-25 19:49       ` Simon Wright
2016-03-13  8:10         ` Simon Wright [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox