Build instructions

More
19 Apr 2013 05:00 #9046 by victzh
Build instructions was created by victzh
Dear PhracturedBlue,

last 2 days I tried to build Deviation from source, and would like to share my experience as a build instruction update. As I did not have all the tools, I acutely know what you actually need to set up. Can you add, that before setting ARM tools on Windows you need to setup MinGW (not only for emulator) and make sure that both msys\1.0\bin and MinGW\bin is in path (or start shell before running make).

Also, did you try to set official "GNU Tools for ARM Embedded Processors" from launchpad.net/gcc-arm-embedded - they seems to be a bit more fresh than YAGARTO.

Please Log in or Create an account to join the conversation.

More
11 Jun 2013 18:00 - 11 Jun 2013 18:03 #10800 by ymboc
Replied by ymboc on topic Build instructions
I'm running into a bit of difficulty building from sources.

On Ubuntu 12.04, I installed the following additional packages to (hopefully) setup the build environment (apt-get install'd):
  • gcc-arm-none-eabi (from the ppa referenced at github.com/esden/summon-arm-toolchain )
  • alibfltk1.3 libportaudio2
  • libnewlib-dev libnewlib0 newlib-source
  • mingw32 mingw32-binutils mingw32-runtime
I'm getting a "hubsan_a7105.c:(.text.initialize+0x1a0): undefined reference to `rand'" error in function 'initialize'.

Which leads me to believe I may a misconfigured build environment...

Can someone offer a gentle nudge in the right direction?

Complete make command line output in Spoiler below:
Warning: Spoiler! [ Click to expand ]
Last edit: 11 Jun 2013 18:03 by ymboc.

Please Log in or Create an account to join the conversation.

More
11 Jun 2013 18:17 - 11 Jun 2013 18:19 #10802 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
It sounds like your newlibc is not setup properly. that is where 'rand()' comes from. But the devo7e build is finicky. Does it work if you build for the devo10?

I don't know anything about using a PPA for the arm toolchain. Just download the script, make it executable and run it. It will build and install gcc and newlibc with the proper patches installed
Last edit: 11 Jun 2013 18:19 by PhracturedBlue.

Please Log in or Create an account to join the conversation.

More
11 Jun 2013 18:22 #10803 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
and yto answer victzh's original qusestions:
1) Yes we should add the dependency on mingw
2) The toolchain used is very important. I tried several, and was only really successful with YAGARTO. Each toolchain has different patches applied, and not all work with STM32. Getting a recent gcc is not that important. The release I use on my build machine:
arm-none-eabi-gcc (Linaro GCC 4.6-2011.10) 4.6.2 20111004 (prerelease)
Generates smaller code (really important for the devo7e) than any newer releases for instance.

Please Log in or Create an account to join the conversation.

More
11 Jun 2013 18:31 #10804 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
ymboc:
also try compiling with:make TARGET=devo7e VERBOSE=1
which will show the compile commands
You can also run this to see if rand is being exported:
grep rand objs/devo7e/symbolfile

Which should produce something like:
disk_writep_rand = 0x080068e1;
rand = 0x0801c725;
srand = 0x0801c70d;

If you still have no luck, send the results of gcc --version

It is possible the toolchain has changed in some way I am unaware of.

Please Log in or Create an account to join the conversation.

More
11 Jun 2013 21:54 - 11 Jun 2013 22:07 #10810 by ymboc
Replied by ymboc on topic Build instructions
As we both kind of suspected something is wrong/missing/unlinked with newlib.

I was hoping to keep an apt-maintained toolchain. I've kept pace with other built-from-source projects in the past... I much prefer the apt repository approach when its available (and working however).

Anyway, the version of gcc was 4.6 at the time of the earlier post but I noticed the ppa toolchain seems intended for 4.7 (by implied version number) so I upgraded to 4.7. Allegedly 4.7 is so supposed to benefit some code-size enhancements

...guess I'm on my own. Any tips on manually linking newlib?

user@host:~/deviation/src$ make TARGET=devo7e VERBOSE=1
Warning: Spoiler! [ Click to expand ]


user@host:~/deviation/src$ grep rand objs/devo7e/symbolfile
Warning: Spoiler! [ Click to expand ]
Last edit: 11 Jun 2013 22:07 by ymboc.

Please Log in or Create an account to join the conversation.

More
11 Jun 2013 23:13 #10812 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
so the problem seems to be that in your gcc chain/newlibc, rand() is either auto-inlined or is not exposed as a symbol.

You can find out which by doing the following:
in target/common_devo/proto_stubs.c
add:
extern void rand();
with the other 'externs'

and add:
rand();
after _usleep();

If that works, I'll commit the change. Otherwise, we'll have to try something else.

Note that I prefer using the built-from-source toolchain, since I can guarantee it never changes on me. This ensures my code doesn't stop working after an 'apt get update'. Because each version of gcc compiles to a different code size, this is something I have actually run into in the past.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 03:14 - 12 Jun 2013 03:15 #10817 by ymboc
Replied by ymboc on topic Build instructions

PhracturedBlue wrote: so the problem seems to be that in your gcc chain/newlibc, rand() is either auto-inlined or is not exposed as a symbol.
...
If that works, I'll commit the change. Otherwise, we'll have to try something else.

That worked. I'll probably end up spending some time trying to figure out why it was necessary / how all this linking stuff works & how to specify which newlib to use (ie: how to select the standard vs the nano version)

PhracturedBlue wrote: Note that I prefer using the built-from-source toolchain, since I can guarantee it never changes on me. This ensures my code doesn't stop working after an 'apt get update'. Because each version of gcc compiles to a different code size, this is something I have actually run into in the past.

I thought about it after my earlier post and I figured you'd say something like that... a stable environment is critical.

Incidentally compiled size of devo7e.dfu ended up being 117345 bytes so at least this particular version of the toolchain didn't seem to add any bloat.

Thanks for all your help
Last edit: 12 Jun 2013 03:15 by ymboc.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 03:23 #10818 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
If you are compiling the latest release, mine compiles to 117121. While that might not seem important, each of the protocol modules is required to be < 4096 bytes. The DSM2 module is hovering right at the edge such that every time I touch it I need to worry about whether it will compile for the Devo7e. So 4 or 8 bytes can be the difference between compiling and me spending time trying to squeeze it down more.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 03:27 - 12 Jun 2013 03:28 #10819 by ymboc
Replied by ymboc on topic Build instructions
Both dsm2.mod & dsmx.mod came in at 3844bytes (Using just-updated-clone)

Thanks for the warning regarding filesize
Last edit: 12 Jun 2013 03:28 by ymboc.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 03:49 #10820 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
Mine is at 3804. So at some point I'll start getting tickets because my code compiles fine but someone else can't re-compile...
Anyhow, there isn't much that can be done about it. I can't even re-build the same gcc I have on another machine, so it is just the price we pay.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 04:41 #10823 by sbstnp
Replied by sbstnp on topic Build instructions
I'm a bit offtopic here but if you want you can use my virtual machine, it has installed the same toolchain as PB is using (same versions) and works nicely.

Probably you just want to do it yourself, but in case you get tired, here is a link to the relevant thread:
deviationtx.com/forum/how-to/1200-vm-ded...-compiling-deviation

Apologies for intruding.

Devo 10 + 4in1
Spektrum Dx9
FrSky Taranis + TBS Crossfire

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 11:34 #10842 by ymboc
Replied by ymboc on topic Build instructions

sbstnp wrote: Probably you just want to do it yourself...

That's pretty much what it is... I need to relearn that which has been forgotten.

Plus I have an always-on ubuntu-based storage box in the house.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 13:09 - 12 Jun 2013 13:09 #10844 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions

ymboc wrote:

PhracturedBlue wrote: so the problem seems to be that in your gcc chain/newlibc, rand() is either auto-inlined or is not exposed as a symbol.
...
If that works, I'll commit the change. Otherwise, we'll have to try something else.

That worked. I'll probably end up spending some time trying to figure out why it was necessary / how all this linking stuff works & how to specify which newlib to use (ie: how to select the standard vs the nano version)

The 'why' is that rand() is only used in the hubsan module. The modules are sort of like loadable executables. However they contain a hard-coded link-table to newlib (and the devo base firmware). That means that every function used in a module must also be used in the main firmware. Since I don't directly use rand() anywhere, it isn't being included in your devo7e build, and thus the module can't link to it.
I have no idea why it works for me. When I look at my devo7e.list file, rand() isn't used anywhere, yet is still included in the target. but noone else has ever complained either.

Anyhow, I added 'rand' as per my instructions above to the current tree. If your dfu works for you, you should be god to go.

I assume you'e seen the DeviationUploader thread which includes a java utility to install the dfu onto your tx from Linux as well?
Last edit: 12 Jun 2013 13:09 by PhracturedBlue.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 17:53 - 12 Jun 2013 17:54 #10863 by ymboc
Replied by ymboc on topic Build instructions

PhracturedBlue wrote: I assume you'e seen the DeviationUploader thread which includes a java utility to install the dfu onto your tx from Linux as well?

I plan on installing the DFU from my windows7 workstation... my linux box is headless and in the basement.

I thought I saw rand() in the emu-builds of dsm2 & devo as well?
Last edit: 12 Jun 2013 17:54 by ymboc.

Please Log in or Create an account to join the conversation.

More
12 Jun 2013 18:43 #10866 by PhracturedBlue
Replied by PhracturedBlue on topic Build instructions
rand is used in various places, but not in the devo7e build

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum