Building ardupilot

two questions

  1. i see binary output in build//bin directory, but i would like to have elf (with debug symbols), how does one build the output in .ELF in addition to .BIN ??

  2. how do you add -g gdb in the $CC command to generate debug infoatmion ?

thanks for the help in advance

1 Like

Have you seen the readme page for waf builds?

You can configure waf to build with debug symbols
Also note that build//bin/arduplane is an ELF file

thank you for the info… i did real the document, but ran into
issue

  when i did the following as i understood from the build

instruction

./waf --debug --board

./waf --vv coptor

i got the following error

  ../../libraries/AP_ROMFS/AP_ROMFS.cpp: In static member function

‘static uint8_t* AP_ROMFS::find_decompress(const char*,
uint32_t&)’:
…/…/libraries/AP_ROMFS/AP_ROMFS.cpp:57:58: error:
‘compressed_size’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
const uint8_t *p = &compressed_data[compressed_size-4];

  compilation terminated due to -Wfatal-errors.
  cc1plus: some warnings being treated as errors

then i thought perhaps i misunderstodd the instruction and tried

./waf --board

./waf --debug --vv coptor

  there was no error building ardupilot,  but the resulting elf

file does not have debug information (and the gcc did not have -g
gdb)

so i am not clear how to generate elf with debug information ???

can you clarify ??

thanks

Hello,

which compiler are you using ?
do a waf distclean then waf configure --debug --board YOUR_BOARD_TYPE and finally waf copter

Unless you want to debug something really specific to your board, did you consider to debug your code on SITL first ?

i am seeing some strange issues, but maybe my total misunderstanding the whole structure of the software.

first of all, is the bootloader necessary ? if i am not interested in mission planner or other things, just want to use st-link for flash my software to control sensors and escs … do i need bootloader ?

perhaps thats my issue, without usign bootloader, and the ardupilot crashses rightaway…

the tool i am using is gcc-arm-none-eabi-6-2017-q2-update… (i found that 2018-q4-major does not work).

also, notice very strange issue… i create my new board and copied files from F4BY (just to see what happen)… it successfully built with “waf --configure myboard”, but if i did “waf --configure myboard --debug”, then it failed to compiled. the strangest thing is that if i did “waf --configure F4BY --debug” it works fine, even though two directories have exact the same files.

also, the documentation maybe outdated regarding porting to a new board, because i think (at least from my poking around), i would need to add board name to Tools/scripts/build_binaries.py and also, add new ID in libraries/AP_HAL/AP_HAL_Boards.h

hello,

If you don’t know what you are doing, keep the bootloader, it will prevent you to brick you board because of malfunctioning software.

To create a new board you need more than copy paste a directory, you need to fill the proper target to the build system.

what error did you get on waf ? normally, it should be quite explicity on what the error is

i got the waf from cloning ardupilot, on the top directory

i am using a STM32F407 discovery for now, just to get familiar with Ardupilot, before going to custom board, so it is not possible to brick the bard as st-link is available to recover

i am just curious how is that when simply renaming the board would make the waf fail, and adding --debug would also fail the build process

(not getting as far as chaning I/O yet because build (waf) did not even finish