- Posts: 1386
Build instructions
- victzh
- Topic Author
- Offline
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.
- ymboc
- Offline
- Posts: 9
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
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:
user@host:~/deviation/src$ make TARGET=devo7e
+ Compiling 'target/devo7e/backlight.c'
+ Compiling 'target/devo7e/channels.c'
+ Compiling 'target/devo7e/crc.c'
+ Compiling 'target/devo7e/lcd.c'
+ Compiling 'target/devo7e/tx_buttons.c'
+ Compiling 'target/common_devo/adc.c'
+ Compiling 'target/common_devo/clock.c'
+ Compiling 'target/common_devo/dump_bootloader.c'
+ Compiling 'target/common_devo/err_handler.c'
+ Compiling 'target/common_devo/errno.c'
+ Compiling 'target/common_devo/fgets.c'
+ Compiling 'target/common_devo/haptic.c'
+ Compiling 'target/common_devo/iwdg.c'
+ Compiling 'target/common_devo/petit_fat.c'
+ Compiling 'target/common_devo/petit_io.c'
+ Compiling 'target/common_devo/power.c'
+ Compiling 'target/common_devo/ppmin.c'
+ Compiling 'target/common_devo/printf.c'
+ Compiling 'target/common_devo/proto_stubs.c'
+ Compiling 'target/common_devo/sound.c'
+ Compiling 'target/common_devo/spi_flash.c'
+ Compiling 'target/common_devo/spi_proto.c'
+ Compiling 'target/common_devo/spi_touch.c'
+ Compiling 'target/common_devo/syscalls.c'
+ Compiling 'target/common_devo/tx_misc.c'
+ Compiling 'target/common_devo/uart.c'
+ Compiling 'target/common_devo/msc2/hw_config.c'
+ Compiling 'target/common_devo/msc2/mass_mal.c'
+ Compiling 'target/common_devo/msc2/memory.c'
+ Compiling 'target/common_devo/msc2/scsi_data.c'
+ Compiling 'target/common_devo/msc2/usb_bot.c'
+ Compiling 'target/common_devo/msc2/usb_desc.c'
+ Compiling 'target/common_devo/msc2/usb_devo8.c'
+ Compiling 'target/common_devo/msc2/usb_endp.c'
+ Compiling 'target/common_devo/msc2/usb_istr.c'
+ Compiling 'target/common_devo/msc2/usb_prop.c'
+ Compiling 'target/common_devo/msc2/usb_pwr.c'
+ Compiling 'target/common_devo/msc2/usb_scsi.c'
+ Compiling 'target/common_devo/msc2/lib/core_cm3.c'
+ Compiling 'target/common_devo/msc2/lib/stm32f10x_flash.c'
+ Compiling 'target/common_devo/msc2/lib/stm32f10x_gpio.c'
+ Compiling 'target/common_devo/msc2/lib/stm32f10x_misc.c'
+ Compiling 'target/common_devo/msc2/lib/stm32f10x_rcc.c'
+ Compiling 'target/common_devo/msc2/lib/usb_core.c'
+ Compiling 'target/common_devo/msc2/lib/usb_init.c'
+ Compiling 'target/common_devo/msc2/lib/usb_int.c'
+ Compiling 'target/common_devo/msc2/lib/usb_mem.c'
+ Compiling 'target/common_devo/msc2/lib/usb_regs.c'
+ Compiling 'target/common_devo/msc2/lib/usb_sil.c'
+ Compiling 'autodimmer.c'
+ Compiling 'battery.c'
+ Compiling 'buttons.c'
+ Compiling 'curves.c'
+ Compiling 'inputs.c'
+ Compiling 'main.c'
+ Compiling 'misc.c'
+ Compiling 'mixer.c'
+ Compiling 'mixer_standard.c'
+ Compiling 'music.c'
+ Compiling 'telemetry.c'
+ Compiling 'timer.c'
+ Compiling 'version.c'
+ Compiling 'screen/lcd_gfx.c'
+ Compiling 'screen/lcd_string.c'
+ Compiling 'screen/128x64x1/lcd_screen.c'
+ Compiling 'screen/128x64x1/usblogo.c'
+ Compiling 'gui/bargraph.c'
+ Compiling 'gui/button.c'
+ Compiling 'gui/dialog.c'
+ Compiling 'gui/gui.c'
+ Compiling 'gui/image.c'
+ Compiling 'gui/keyboard.c'
+ Compiling 'gui/label.c'
+ Compiling 'gui/listbox.c'
+ Compiling 'gui/rect.c'
+ Compiling 'gui/scrollable.c'
+ Compiling 'gui/scrollbar.c'
+ Compiling 'gui/textsel.c'
+ Compiling 'gui/xygraph.c'
+ Compiling 'pages/128x64x1/about_page.c'
+ Compiling 'pages/128x64x1/chantest_page.c'
+ Compiling 'pages/128x64x1/dialogs.c'
+ Compiling 'pages/128x64x1/lang_select.c'
+ Compiling 'pages/128x64x1/main_config.c'
+ Compiling 'pages/128x64x1/main_page.c'
+ Compiling 'pages/128x64x1/menus.c'
+ Compiling 'pages/128x64x1/model_config.c'
+ Compiling 'pages/128x64x1/model_loadsave.c'
+ Compiling 'pages/128x64x1/model_page.c'
+ Compiling 'pages/128x64x1/pages.c'
+ Compiling 'pages/128x64x1/reorder_list.c'
+ Compiling 'pages/128x64x1/splash_page.c'
+ Compiling 'pages/128x64x1/telemconfig_page.c'
+ Compiling 'pages/128x64x1/telemtest_page.c'
+ Compiling 'pages/128x64x1/timer_page.c'
+ Compiling 'pages/128x64x1/toggle_select.c'
+ Compiling 'pages/128x64x1/trim_page.c'
+ Compiling 'pages/128x64x1/tx_configure.c'
+ Compiling 'pages/128x64x1/usb_page.c'
+ Compiling 'config/display.c'
+ Compiling 'config/ini.c'
+ Compiling 'config/language.c'
+ Compiling 'config/model.c'
+ Compiling 'config/tx.c'
+ Compiling 'protocol/protocol.c'
+ Compiling 'pages/128x64x1/standard/common_standard.c'
+ Compiling 'pages/128x64x1/standard/curves_page.c'
+ Compiling 'pages/128x64x1/standard/drexp_page.c'
+ Compiling 'pages/128x64x1/standard/failsafe_page.c'
+ Compiling 'pages/128x64x1/standard/gyrosense_page.c'
+ Compiling 'pages/128x64x1/standard/reverse_page.c'
+ Compiling 'pages/128x64x1/standard/subtrim_page.c'
+ Compiling 'pages/128x64x1/standard/swash_page.c'
+ Compiling 'pages/128x64x1/standard/switchassign_page.c'
+ Compiling 'pages/128x64x1/standard/throhold_page.c'
+ Compiling 'pages/128x64x1/standard/traveladj_page.c'
+ Compiling 'pages/128x64x1/advanced/mixer_curves.c'
+ Compiling 'pages/128x64x1/advanced/mixer_limits.c'
+ Compiling 'pages/128x64x1/advanced/mixer_page.c'
+ Compiling 'pages/128x64x1/advanced/mixer_setup.c'
UPDATING HEADERS
BUILD lib/stm32/f1
CP libopencm3_stm32f1.ld
CC rcc.o
CC gpio.o
CC usart.o
CC adc.o
CC spi.o
CC flash.o
CC rtc.o
CC i2c.o
CC dma.o
CC exti.o
CC ethernet.o
CC usb_f103.o
CC usb.o
CC usb_control.o
CC usb_standard.o
CC can.o
CC timer.o
CC usb_f107.o
CC desig.o
CC crc.o
CC dac.o
CC iwdg.o
CC pwr.o
CC usb_fx07_common.o
CC gpio_common_all.o
CC vector.o
CC systick.o
CC scb.o
CC nvic.o
CC assert.o
AR libopencm3_stm32f1.a
+ Building 'devo7e.elf'
+ Optimizing placement and re-linking
ROM: 0x08003000 - 0x0801f8e0 = 114.22kB
RAM: 0x20000000 - 0x2000279c = 9.90kB
Found 12 ranges
Found 16 ranges
Found 1 ranges
+ Copying template files for devo7e
+ Checking string list length for devo7e
+ Compiling 'protocol/devo.c'
+ Compiling 'target/common_devo/protocol/a7105.c'
+ Compiling 'target/common_devo/protocol/cc2500.c'
+ Compiling 'target/common_devo/protocol/cyrf6936.c'
+ Compiling 'target/common_devo/protocol/nrf24l01.c'
+ Compiling 'target/common_devo/protocol/pwm.c'
+ Building 'objs/devo7e/devo.bin'
Building devo module
+ Compiling 'protocol/dsm2.c'
+ Building 'objs/devo7e/dsm2.bin'
Building dsm2 module
Building dsmx module
+ Compiling 'protocol/flysky_a7105.c'
+ Building 'objs/devo7e/flysky_a7105.bin'
Building flysky module
+ Compiling 'protocol/hubsan_a7105.c'
+ Building 'objs/devo7e/hubsan_a7105.bin'
objs/devo7e/hubsan_a7105.o: In function `initialize':
hubsan_a7105.c:(.text.initialize+0x1a0): undefined reference to `rand'
make: *** [objs/devo7e/hubsan_a7105.bin] Error 1
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
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
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
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.
- PhracturedBlue
- Offline
- Posts: 4402
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.
- ymboc
- Offline
- Posts: 9
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
+ Copying template files for devo7e
mkdir -p filesystem/devo7e || true
cp -prf filesystem/common/media filesystem/devo7e/
cp -prf filesystem/common/template filesystem/devo7e/
cp tx_template.ini filesystem/devo7e/tx.ini
echo 'empty' > filesystem/devo7e/errors.txt
mkdir filesystem/devo7e/models 2> /dev/null || true
echo 'name=Model1' > filesystem/devo7e/models/model1.ini \
&& cat model_template.ini >> filesystem/devo7e/models/model1.ini
cp model_template.ini filesystem/devo7e/models/default.ini
mkdir filesystem/devo7e/language 2> /dev/null; \
../utils/extract_strings.pl -target devo7e -update
export tx=devo7e; \
number=2 ; while [ $number -le 30 ] ; do \
cp model_template.ini filesystem/$tx/models/model$number.ini; \
number=`expr $number + 1`; \
done
+ Checking string list length for devo7e
../utils/check_string_size.pl -target devo7e -quiet
cp -pf filesystem/devo10/media/*.fon filesystem/devo7e/media/
cp -pf filesystem/devo10/media/*.bmp filesystem/devo7e/media/
cp -pf filesystem/devo10/media/*.ini filesystem/devo7e/media/
cp -prf filesystem/devo10/modelico filesystem/devo7e/
rm -rf filesystem/devo7e/language
perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/devo7e/tx.ini
+ Building 'objs/devo7e/hubsan_a7105.bin'
arm-none-eabi-ld -o objs/devo7e/hubsan_a7105.elf objs/devo7e/hubsan_a7105.o objs/devo7e/a7105.o objs/devo7e/cc2500.o objs/devo7e/cyrf6936.o objs/devo7e/nrf24l01.o objs/devo7e/pwm.o -gc-sections -Map=objs/devo7e/hubsan_a7105.map \
--cref -Ttarget/devo7e/protocol.ld --just-symbols=objs/devo7e/symbolfile
objs/devo7e/hubsan_a7105.o: In function `initialize':
hubsan_a7105.c:(.text.initialize+0x1a0): undefined reference to `rand'
make: *** [objs/devo7e/hubsan_a7105.bin] Error 1
user@host:~/deviation/src$ grep rand objs/devo7e/symbolfile
disk_writep_rand = 0x080068a1;
srand = 0x0801c655;
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
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.
- ymboc
- Offline
- Posts: 9
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: 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.
I thought about it after my earlier post and I figured you'd say something like that... a stable environment is critical.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.
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
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- ymboc
- Offline
- Posts: 9
Thanks for the warning regarding filesize
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
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.
- sbstnp
- Offline
- Posts: 649
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
FrSky Taranis + TBS Crossfire
Please Log in or Create an account to join the conversation.
- ymboc
- Offline
- Posts: 9
That's pretty much what it is... I need to relearn that which has been forgotten.sbstnp wrote: Probably you just want to do it yourself...
Plus I have an always-on ubuntu-based storage box in the house.
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
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.ymboc wrote:
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: 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.
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?
Please Log in or Create an account to join the conversation.
- ymboc
- Offline
- Posts: 9
I plan on installing the DFU from my windows7 workstation... my linux box is headless and in the basement.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 thought I saw rand() in the emu-builds of dsm2 & devo as well?
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Development
- Build instructions