apache / nuttx

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

Configuration error #9428

Closed pryan1k69 closed 1 year ago

pryan1k69 commented 1 year ago

I want to add my board to Nuttx.

Added as in the official instructions. When I enter tools/configure.sh -L then my board is displayed in the list. But when I try to configure tools/configure.sh -l myboard:nsh an error occurs:

  Copy files
  Select CONFIG_HOST_LINUX=y
  Refreshing...
CP: arch/dummy/Kconfig to /home/allwinner/Desktop/nuttx-master_1/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /home/allwinner/Desktop/nuttx-master_1/boards/dummy/dummy_kconfig
LN: platform/board to /home/allwinner/Desktop/apps/platform/
LN: include/arch to arch//include
No directory at /home/allwinner/Desktop/nuttx-master_1/arch//include
make[1]: *** [tools/Unix.mk:272: include/arch] Error 1
make: *** [tools/Unix.mk:655: olddefconfig] Error 2
ERROR: failed to refresh

I can't figure out what the problem is. Can you help me?

TimJTi commented 1 year ago

A double forward slash is probably the problem but why it's there I don't know!

pryan1k69 commented 1 year ago

I have solved this issue. It was necessary to add the configuration setting to defconfig file:

CONFIG_ARCH="arm" # for example
CONFIG_ARCH_BOARD="board-name"
CONFIG_ARCH_BOARD_board-name=y
CONFIG_ARCH_CHIP="chip-name"
CONFIG_ARCH_CHIP_chip-name=y

located in configs/nsh folder in boards folder.

patacongo commented 1 year ago

I have solved this issue. It was necessary to add the configuration setting to defconfig file:

Are you editing the defconfig files by hand? That would be a bad idea. You will make a lot of mistakes and this will cost you time to fix. You should do:

make menuconfig
pryan1k69 commented 1 year ago

Yes, it was a bad idea to modify defconfig file. When I enter make menuconfig I get a new error. But the problem is that if you do not change defconfig file, then I do not know how to configure without the error that occurred above

btashton commented 1 year ago

One of the common issues I have seen that looks like this when adding a new board, it not making all the required changes.

in boards/Kconfig there are three changes you need to make

You need to create an entry here


choice
        prompt "Select target board"
        default ARCH_BOARD_CUSTOM
        ---help---
                Select the board hosting the architecture.  You must first select the
                exact MCU part number, then the boards supporting that part will
                be available for selection.  Use ARCH_BOARD_CUSTOM to create a new
                board configuration.

config ARCH_BOARD_AMBER
        bool "Amber Web Server"
        depends on ARCH_CHIP_ATMEGA128
        ---help---
                This is placeholder for the SoC Robotics Amber Web Server that is based
                on the Atmel AVR ATMega128 MCU.  There is not much there yet and what is
                there is untested due to tool-related issues.

config ARCH_BOARD_ARDUINO_MEGA2560
        bool "Arduino Mega 2560"
        depends on ARCH_CHIP_ATMEGA2560
        ---help---
                This option selects the Arduino Mega 2560 board featuring the Atmel
                Atmega2560 MCU running at 16 MHz.

config ARCH_BOARD_ARDUINO_DUE
        bool "Arduino Due"
        depends on ARCH_CHIP_ATSAM3X8E
        select ARCH_HAVE_LEDS
        ---help---
                This options selects the Arduino DUE board featuring the Atmel
                ATSAM3X8E MCU running at 84 MHz.

Add to the list here

config ARCH_BOARD
        string
        default "amber"                     if ARCH_BOARD_AMBER
        default "arduino-mega2560"          if ARCH_BOARD_ARDUINO_MEGA2560
        default "arduino-due"               if ARCH_BOARD_ARDUINO_DUE
        default "arduino-m0"                if ARCH_BOARD_ARDUINO_M0

and here

comment "Board-Specific Options"

if ARCH_BOARD_PCDUINO_A10
source "boards/arm/a1x/pcduino-a10/Kconfig"
endif
if ARCH_BOARD_BEAGLEBONE_BLACK
source "boards/arm/am335x/beaglebone-black/Kconfig"
endif
if ARCH_BOARD_C5471EVM
source "boards/arm/c5471/c5471evm/Kconfig"
endif
if ARCH_BOARD_SPRESENSE
source "boards/arm/cxd56xx/spresense/Kconfig"
endif
if ARCH_BOARD_NTOSD_DM320

If you have made those changes you should be able to take an existing config, change the chip and see your board available.

pryan1k69 commented 1 year ago

One of the common issues I have seen that looks like this when adding a new board, it not making all the required changes.

in boards/Kconfig there are three changes you need to make

You need to create an entry here


choice
        prompt "Select target board"
        default ARCH_BOARD_CUSTOM
        ---help---
                Select the board hosting the architecture.  You must first select the
                exact MCU part number, then the boards supporting that part will
                be available for selection.  Use ARCH_BOARD_CUSTOM to create a new
                board configuration.

config ARCH_BOARD_AMBER
        bool "Amber Web Server"
        depends on ARCH_CHIP_ATMEGA128
        ---help---
                This is placeholder for the SoC Robotics Amber Web Server that is based
                on the Atmel AVR ATMega128 MCU.  There is not much there yet and what is
                there is untested due to tool-related issues.

config ARCH_BOARD_ARDUINO_MEGA2560
        bool "Arduino Mega 2560"
        depends on ARCH_CHIP_ATMEGA2560
        ---help---
                This option selects the Arduino Mega 2560 board featuring the Atmel
                Atmega2560 MCU running at 16 MHz.

config ARCH_BOARD_ARDUINO_DUE
        bool "Arduino Due"
        depends on ARCH_CHIP_ATSAM3X8E
        select ARCH_HAVE_LEDS
        ---help---
                This options selects the Arduino DUE board featuring the Atmel
                ATSAM3X8E MCU running at 84 MHz.

Add to the list here

config ARCH_BOARD
        string
        default "amber"                     if ARCH_BOARD_AMBER
        default "arduino-mega2560"          if ARCH_BOARD_ARDUINO_MEGA2560
        default "arduino-due"               if ARCH_BOARD_ARDUINO_DUE
        default "arduino-m0"                if ARCH_BOARD_ARDUINO_M0

and here

comment "Board-Specific Options"

if ARCH_BOARD_PCDUINO_A10
source "boards/arm/a1x/pcduino-a10/Kconfig"
endif
if ARCH_BOARD_BEAGLEBONE_BLACK
source "boards/arm/am335x/beaglebone-black/Kconfig"
endif
if ARCH_BOARD_C5471EVM
source "boards/arm/c5471/c5471evm/Kconfig"
endif
if ARCH_BOARD_SPRESENSE
source "boards/arm/cxd56xx/spresense/Kconfig"
endif
if ARCH_BOARD_NTOSD_DM320

If you have made those changes you should be able to take an existing config, change the chip and see your board available.

Yes, I did as you say. But the error remains exactly the same, although my board is displayed in the list of available

TimJTi commented 1 year ago

Unless I missed it, was is the different error you now get?

In the last year I have found I need to do a distclean and/or make apps_clean to clear odd errors and recently came across make olddefconfig ( the exact name is from memory) which is undocumented but might be something to do with bringing old defconfig up to date with newer NuttX versions?

pryan1k69 commented 1 year ago

The error is still the same. That is, it still fails to execute the command: tools/configure.sh -l myboard:nsh If I understand you correctly, then make distclean or make olddefconfig is possible only after configuration

TimJTi commented 1 year ago

Yes, after a make menuconfig. The // in this doesn't look right though?

/home/allwinner/Desktop/nuttx-master_1/arch//include

pryan1k69 commented 1 year ago

Yes

pryan1k69 commented 1 year ago

I think there should be board_name, but for some reason it does not see it

acassis commented 1 year ago

@btashton AFAIK when you just create a new board (adding it to those 3 positions at Kconfig) you yet still need to have a boardname/configs/nsh/defconfig adapted to this new board. I think it is a dilemma: we cannot edit the defconfig, but we need a defconfig to use with ./tools/configure.sh to this new board. @patacongo am I missing something on this process?

TimJTi commented 1 year ago

Always easier to start from a board that is similar and use make menuconfig for changes, then make savedefconfig and copy to a new location.

That's what I did, adding my own boards Kconfig as I grew more familiar with it all.

patacongo commented 1 year ago

@btashton AFAIK when you just create a new board (adding it to those 3 positions at Kconfig) you yet still need to have a boardname/configs/nsh/defconfig adapted to this new board. I think it is a dilemma: we cannot edit the defconfig, but we need a defconfig to use with ./tools/configure.sh to this new board. @patacongo am I missing something on this process?

I am not aware of many specific problems with this. The procedure outlined by @TimJTi generally works. I am aware of a couple of things:

TimJTi commented 1 year ago

Make clean_context also needs documenting

pryan1k69 commented 1 year ago

Thanks @TimJTi for the advice on using a similar board and making changes using make menuconfig. Thanks to this, I was able to add my board to Nuttx. The problem is solved.