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,ad47c3851d906864 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.125.233 with SMTP id mt9mr11548657pbb.5.1335604935197; Sat, 28 Apr 2012 02:22:15 -0700 (PDT) Path: r9ni107671pbh.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Ada on Nintendo DS ? Date: Sat, 28 Apr 2012 09:22:14 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Date: Sat, 28 Apr 2012 09:22:14 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="DkTdSjxOCm6DqG+Uf7eArg"; logging-data="9156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zICyW6WhHNOe8BXHtiGH0uFPjbkvGYiY=" User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Cancel-Lock: sha1:x6hMgMOKm5iHn7JRejY1L0X7gLo= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-04-28T09:22:14+00:00 List-Id: On Fri, 27 Apr 2012 18:56:10 +0000, Natasha Kerensikova wrote: > Hello, > > I have been desiring getting a try at developing for embedded platforms > for a while now. Me too, though I haven't had all the success I would like, so far! But I hope a beginner's viewpoint (at building gcc) may be of some interest... In my case I want to be able to build the same version of gcc for native x86/x64, AVR (Arduino etc), Android, Raspberry Pi. I have managed the first two of these last month,(got stuck on Arm/Android last summer, moving house keeps getting in the way) SO some comments that may help... apologies if the details are inaccurate, my notes are on another machine. (1) Building GCC "should be straightforward" as Stephen Leake says. However it probably took me three weeks for x86 and AVR... (a) Read the prerequisites but they may not be entirely accurate, and differ for different gcc versions, and Ada support in crosscompilers is a less explored corner... My starting point, gcc_4.7.0_rc1_20120302 failed to build with one version of mpfr, and then failed another "prerequisite" (ppl or ploog) when I turned on Ada language support. I backtracked a version on the first, and omitted the second (which turned out to be an optional prerequisite). The prerequisites gmp, mpc, mpfr are essential, others seem to be optional so far. (b) Do not build in the source dir. The FAQ isn't kidding about this. (c) Script the process. Helps to repeat it in the same order each time. I made many errors not doing so. Safest to delete the "build" directory each time (but slowest). (d) Build a native version first. Then build it again, using itself as the compiler. If it can build itself, THEN use it to build a crosscompiler. Build the crosscompiler with C support only first, then build the C library, then turn on Ada support and build again. (e) If it goes wrong, the gcc build system is so obscure that I found it difficult to make any progress, and sometimes had to do things the completely *wrong* way to move forward, intending to learn the right way later. e.g. patching a Makefile each time from the script, because I don't understand how to make the autoconfigure tools generate it correctly in the first place... (f) Building gcc crosscompilers with Ada support definitely feels lonely... I must say gcc4.7 rc1 seemed to build with fewer problems than the gcc4.6 version I was trying to build last summer. But having a working compiler (or using gnatdroid) is only part of the problem... > Moreover, I just happen to own a device that probably qualifies as > embedded, with two ARM CPUs (one ARM7 and one ARM9), 4 MB RAM and a few > DSPs. The device is known as Nintendo DS lite. I know nothing about the runtime support on that system. There are probably 2 levels of problem : (1) how to get a basic executable to run (gnatdroid produces console apps that run successfully on the Android) and (2) how to tap into the machine's higher level facilities, gamepad, GUI etc. This still seems to be a sticking point with Gnatdroid/Android let alone the Nintendo... > As far as I can tell, devkitARM is a toolchain derived from GCC that > targets my hardware (it seems there is also some libraries to deal with > DSPs and stuff, but I can care about this later on). If its source is available, building it with Ada support may be possible. But what version of gcc? Bad BAD bad things happen when building gcc4.3.3 with gcc4.5 for example - like negative enumerations (which 4.3 uses and 4.5 rejects as errors! Or the runtime system (libc, interface to GUI etc) may be portable to a newer GCC. Or you may be able to substitute the right version of GCC, separately built, with Ada support. But any of these may fail to build unless you can find or recreate the correct patches. IMO gcc is frighteningly fragile... > On the other end, > gnatdroid seems to successfully translate Ada code into binary that can > be fed to ARM CPUs. So unless I'm missing something, there is nothing > new to discover, I would only need to merge both derivations. A promising approach, I think. Where I fell over was combining gnatdroid's output into the Android NDK build system to use anything more sophisticated than the console - i.e. open a simple window and display "Hello World". (I could get it through the linker, but the resulting executable didn't work) I can imagine similar problems with the Nintendo. > Maybe I should start with smaller steps, like writing C stuff going > through devkitARM, and then only start aiming at Ada? Definitely. This is an essential part of the process, so you have a "known good" chain to compare the Ada chain to, step by step. Can I substitute my Ada .o for this C .o into the linker? If not, what is different between them? >Would anyone have an estimation or a bound on how difficult it can be? Difficult. But IMO the more people building Ada for embedded platforms, the easier it will become, if we share information and feed back fixes into the process. (Which I have not been doing, mainly because what I see as an obstacle, probably arises from my own blockheadedness rather than a genuine bug in gcc. And I have felt reluctant to submit them to sanity checks before passing any potential bugs upstream - mainly because there don't seem t be many of us trying it, so where to submit them?. Clearly there are some, as Jacob Sperre-Andersen recently reported success on Raspberry Pi If you think my notes/scripts so far may be useful, I'll pass them on.) Consider having another platform available as another way of moving forward. (This works on the Raspberry Pi but not the Nintendo... what is different between them?) > Thanks in advance for your insights, > Natasha