apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.52k stars 1.07k forks source link

Can't build custom board #12122

Open fdcavalcanti opened 3 months ago

fdcavalcanti commented 3 months ago

Hi everyone,

I'm trying to create a custom board that is based on a Nucleo-144. I want to have this board versioned so I simply copied the directory boads/arm/stm32f7/nucleo-144 to my repository. On the configs directory, I removed all but one of the configs. On defconfig, I added those lines below CONFIG_ARCH:

CONFIG_ARCH_BOARD_CUSTOM=y
CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
CONFIG_ARCH_BOARD_CUSTOM_DIR="../../test-nucleo-144"
CONFIG_ARCH_BOARD_CUSTOM_NAME="test-nucleo-144"

And commented:

# CONFIG_ARCH_BOARD="nucleo-144"
# CONFIG_ARCH_BOARD_NUCLEO_144=y

Other than that, I removed everything from Kconfig.

I can open menuconfig just fine after executing the configure script with: ./tools/configure.sh -a ../nuttx-apps -l ../../test-nucleo-144/configs/nsh

Running make I get this error:

$ make -j
Create version.h
LN: platform/board to /home/filipe/rad-stm-fw-poc/nuttxspace/nuttx-apps/platform/dummy
Register: nsh
Register: sh
CC:  dirent/lib_opendir.c chip/stm32_allocateheap.c:168:6: warning: #warning "DTCM excluded from the heap" [-Wcpp]
  168 | #    warning "DTCM excluded from the heap"
      |      ^~~~~~~
CPP:  /home/filipe/test/nuttxspace/nuttx/../../test-nucleo-144/scripts/f746-flash.ld-> /home/filipe/test/nuttxspace/nuttx/../../test-nucleo-144/scripts/f746-flash.ld.tmp make[2]: *** No rule to make target 'libboard.a'.  Stop.
make[1]: *** [Makefile:181: board/libboard.a] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [tools/Unix.mk:546: nuttx] Error 2

This issue is very similar to #2206 but I can't seem to make it work. Any thoughts? I would love to fix this and then improve the custom board documentation.

Thanks.

acassis commented 3 months ago

@fdcavalcanti I just saw that our documentation for custom board is very shallow: https://nuttx.apache.org/docs/latest/guides/customboards.html# we need something like Custom Apps that @TimJTi wrote.

The error means that some Makefile rules or path to create libboard.a is missing.

BTW, if this board is a commercial board (i.e. from ST) then it is better to add it as official board into NuttX mainline.

fdcavalcanti commented 3 months ago

Hi @acassis. Its not a commercial board. I'm using a Nucleo-144 integrating in a different equipment as a proof of concept. Its just easier for me to version only the board files and use the custom board settings.

TimJTi commented 3 months ago

@fdcavalcanti - have you tried the instructions to move it completely out-of-tree? It works for me.

@acassis - I "ported" the custom boards stuff from the old Wiki (Confluence?) to the current documentation tree and added a bit to it too if I recall. I will revisit it tomorrow and see if it still holds true or needs enhancement - but it is only for out-of-tree boards. I think there's different documentation somewhere or other for in-tree new boards - I'll look, and see if it needs any work that I can see.

fdcavalcanti commented 3 months ago

Hello @TimJTi thanks for the input. Yes I tried. I also applied the modifications in the issue description above. This is really an issue now because I think porting to a similar board, out-of-tree, should been simple. I need to do this PoC and am stuck in what seems to be a basic issue.

I'll keep trying to figure it out and hopefully I can contribute on fixing and documenting.

Thanks

fdcavalcanti commented 3 months ago

Right, so I got it to compile by reading some issues from make export in #10388 Just had to add CONFIG_ARCH_BOARD_COMMON=y. I understand that there is a common directory inside boards/stm32f7 but since no defconfig had it, I didn't even think about it before. I'll keep working on it, try and track down other issues and I'll update the docs.

Thanks everyone.