From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,69431b06fe9a3239 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: How do I disable elaboration code on this Date: Mon, 11 Apr 2011 11:59:03 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <58bc4fb4-5f6a-48d6-9c98-0dde7ac619df@p16g2000vbo.googlegroups.com> <4da2176e$0$6977$9b4e6d93@newsspool4.arcor-online.net> <93b20b91-03ed-48d2-87b6-a109127a5a4f@l18g2000yql.googlegroups.com> <6bca8b26-152f-482c-95c0-1abf88b6b29b@a26g2000vbo.googlegroups.com> Injection-Date: Mon, 11 Apr 2011 11:59:03 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="4pjzwDT2MPp9AkNxUo/C4Q"; logging-data="28546"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xlqZlN/joqkbwswPl7PxFL1foGKIyfTU=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:XtQ5WRwCv6Bx1MxEAYauJuniXdk= Xref: g2news1.google.com comp.lang.ada:18756 Date: 2011-04-11T11:59:03+00:00 List-Id: On 2011-04-11, Simon Wright wrote: > Lucretia writes: > >> The problem has nothing to do with the linker, I'm using binutils and >> gnat that I'e built myself. The problem is that GNAT is generating >> elaboration code where it is not allowed, i.e. code that 1) >> initialises the array to 0 and 2) code that the copies function >> addresses into the array. >> >> If this cannot work then I'm surprised and I'll be forced to use >> separate constants as noted by Rolf. It just seems like overkill >> having to specify each element separately when an array is the right >> structure ffor the job. >> >> And in other languages like C it doesn't do the same thing. You can >> specify a static constant array and it'll initialise it with the right >> data. > > And can you also specify the load address? > On Cortex M3 devices using C, this array is placed in it's own section and is placed at address 0 by the linker script. The issue here is that when the Cortex M3 comes out of reset it reads, and loads, the stack pointer from the first longword in that array and then jumps to the address specified by the second longword. To Luke: are you targetting only the Cortex M3 or traditional ARM7 devices as well ? If you are targetting the latter as well, you may wish to think about just using a wrapper as you would need to have assembly wrappers anyway for the ARM7 device. (For anyone here unfamiliar with ARM7 devices, when traditional ARM7 devices come out of reset, you cannot even run C code until you have setup a SP in the startup code). Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world