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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.176.2.16 with SMTP id 16mr14085163uas.5.1469421303778; Sun, 24 Jul 2016 21:35:03 -0700 (PDT) X-Received: by 10.157.32.22 with SMTP id n22mr743061ota.2.1469421303738; Sun, 24 Jul 2016 21:35:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!j37no4420761qta.0!news-out.google.com!d68ni5744ith.0!nntp.google.com!f6no4347047ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 24 Jul 2016 21:35:02 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:187:8100:ea06:b093:dfff:fe47:78de; posting-account=bO_2BwoAAACOSVlJSmplhh_hzrBSzyOY NNTP-Posting-Host: 2601:187:8100:ea06:b093:dfff:fe47:78de References: <24d4ffc3-3915-4102-96ae-68d11d881443@googlegroups.com> <240a0f13-0a34-475f-999f-ba7f47be069f@googlegroups.com> <8f1332f8-89cc-4616-9834-1d2ffcfe7a4a@googlegroups.com> <97a5b5a7-4127-4610-b6a2-07f1a434a5cb@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0f7d1cd7-bde9-4fe0-80e0-332e886586e4@googlegroups.com> Subject: Re: Inspirels Ada on cortex tutorial linker issue From: Devin Injection-Date: Mon, 25 Jul 2016 04:35:03 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:31145 Date: 2016-07-24T21:35:02-07:00 List-Id: On Sunday, July 24, 2016 at 9:41:17 AM UTC+2, Simon Wright wrote: > Devin writes: > > > Yes, after looking at the assembly, I recompiled using: > > $ gcc -c -mcpu=cortex-m0 -mthumb -mfloat-abi=soft program.adb > > > > From the looks of it, the exception handling is added at compile time > > when making the program.o file? Would I be able to edit system.ads to > > turn off exception handling? > > It turns out that it's the .fnstart/.fnend assembler directives. > > It is indeed system.ads that needs changing, but I'd strongly advise not > editing the installed one (unless you never intend to compile Ada for > the Pi natively!). > > I've been playing around with my own native system.ads and I can't see > what needs to be tweaked. However, if I create a minimal runtime system > using one of the AdaCore-supplied ARM system.ads's > (ravenscar-sfp-stm32f4/arch, to be exact) the offending asm constructs > don't appear. > > To create this minimal RTS you need > * a directory, say rts/ > * containing an empty directory adalib/ > * and a directory adainclude/ containing the system.ads to be used. > > Then compile with this RTS: > > $ gcc --RTS=rts -c -u -f -mcpu=cortex-m0 -mthumb -mfloat-abi=soft program.adb > > I've put a copy of the RTS I used at > https://www.dropbox.com/s/iyff5ir5bl41hpd/rts.tar.gz?dl=0 > > Hope this works for you! That got me quite a bit further to getting it running. I did have to comment out a line: pragma Restrictions (No_Task_At_Interrupt_Priority); in order to get it to compile, it causes an error: fatal error: system.ads is incorrectly formatted unrecognized or incorrect restrictions pragma: No_Task_At_Interrupt_Priority compilation abandoned If I comment the line out, it compiles and links fine (but I can not get openOCD to load the firmware to the Nucleo32). In openocd I get a warning saying that there are no flash banks found for addresses 10000000 and 10000100 and it says it writes 0 bytes from file program.bin and resets the target. The Nucleo32 then starts running the same firmware that it shipped with. Thank you very much for all your help, Simon.