Adapt px4_nuttx to sama5d3-xplained / cortex-A5 board

#1

Hi,
I want to adapt PX4_nuttx to sama5d3-xplained board. No errors occurred in program compilation. But, there was an error when linking the program.

PX4 nuttx not support Cortex-A, only suport Cortex-M, So, I modify “Toolchain-arm-none-eabi.cmake” file, add “elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL “cortex-a5”)”, look:
…………
set(cpu_flags)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL “cortex-m7”)
set(cpu_flags “-mcpu=cortex-m7 -mthumb -march=armv7e-m -mfpu=fpv5-d16 -mfloat-abi=hard”)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL “cortex-m4”)
set(cpu_flags “-mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard”)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL “cortex-m3”)
set(cpu_flags “-mcpu=cortex-m3 -mthumb -march=armv7-m”)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL “cortex-a5”)
set(cpu_flags “-mcpu=cortex-a5 -march=armv7-a -mfpu=vfpv4-d16 -mfloat-abi=hard”)
else ()
message(FATAL_ERROR “Processor not recognised in toolchain file”)
endif()
…………

Terminal output:
– The ASM compiler identification is GNU
– Found assembler: /home/comet/TOOLS/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc
– Found PythonInterp: /usr/bin/python (found version “2.7.15”)
– Found PY_jinja2: /usr/local/lib/python2.7/dist-packages/jinja2
– C compiler: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
– C++ compiler: arm-none-eabi-g++ (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
– PX4 ECL: Very lightweight Estimation & Control Library v0.9.0-567-g4d59c83
– NuttX: sama5d3-xplained nsh cortex-a5
– ROMFS: px4fmu_common
– Configuring done
– Generating done
– Build files have been written to: /home/comet/ZENITH/Firmware/build/nuttx_sama5d3-xplained_default
ninja: Entering directory `/home/comet/ZENITH/Firmware/build/nuttx_sama5d3-xplained_default’
[203/204] Generating …/…/sama5d3-xplained.bin
FAILED: sama5d3-xplained.bin
cd /home/comet/ZENITH/Firmware/build/nuttx_sama5d3-xplained_default/platforms/nuttx && /home/comet/TOOLS/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-objcopy -O binary …/…//nuttx_sama5d3-xplained_default.elf …/…//sama5d3-xplained.bin
/home/comet/TOOLS/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-objcopy: error: the input file ‘…/…//nuttx_sama5d3-xplained_default.elf’ has no sections
ninja: build stopped: subcommand failed.
Makefile:148: recipe for target ‘nuttx_sama5d3-xplained_default’ failed
make: *** [nuttx_sama5d3-xplained_default] Error 1

View ELF file information:
comet@COMET-PC:~$ readelf -a nuttx_sama5d3-xplained_default.elf
ELF 头:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
类别: ELF32
数据: 2 补码,小端序 (little endian)
版本: 1 (current)
OS/ABI: UNIX - System V
ABI 版本: 0
类型: EXEC (可执行文件)
系统架构: ARM
版本: 0x1
入口点地址: 0x20008000
程序头起点: 0 (bytes into file)
Start of section headers: 328 (bytes into file)
标志: 0x5000400, Version5 EABI, hard-float ABI
本头的大小: 52 (字节)
程序头大小: 0 (字节)
Number of program headers: 0
节头大小: 40 (字节)
节头数量: 4
字符串表索引节头: 3

节头:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .symtab SYMTAB 00000000 000034 0000b0 10 2 1 4
[ 2] .strtab STRTAB 00000000 0000e4 000049 00 0 0 1
[ 3] .shstrtab STRTAB 00000000 00012d 00001b 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
y (purecode), p (processor specific)

There are no section groups in this file.

本文件中没有程序头。

There is no dynamic section in this file.

该文件中没有重定位信息。

There are no unwind sections in this file.

Symbol table ‘.symtab’ contains 11 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _etext
2: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _sbss
3: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _einit
4: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _sdata
5: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _ebss
6: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _snoinit
7: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _enoinit
8: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _sinit
9: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _edata
10: 20008000 0 NOTYPE GLOBAL DEFAULT ABS _stext

No version information found in this file.
comet@COMET-PC:~$

Why “nuttx_sama5d3-xplained_default.elf’ has no sections”?
Who can help me?

Sorry, my English is poor.

1 Like