Hello Abdelatif,

"Which is forcing a common directory when there isn't one. " -- This
statement is not true as we have
https://github.com/apache/incubator-nuttx/blob/b953296de73ac75bb380a609f9f30e9fe34e7622/tools/Unix.mk#L272-L277
that depends on if "BOARD_COMMON_DIR" exists or not.

Getting back to original question:

> To build my apps I just need to create a symbolic link called external
> inside apps folder. To create a new custom board I start copying a similar
> board (e.g nucleo-g431kb) to my-boards folder and make the following changes
>
> *remove from defconfig:*
> CONFIG_ARCH_BOARD="nucleo-g431kb"
> CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
>
> *add on defconfig:*
> CONFIG_ARCH_BOARD_CUSTOM=y
> CONFIG_ARCH_BOARD_CUSTOM_DIR="../my-folder/my-boards/custom-board"
> CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
> CONFIG_ARCH_BOARD_CUSTOM_NAME="custom-board"
>
> *Rename src/Make.defs to src/Makefile and append the line *
> include $(TOPDIR)/boards/Board.mk at the end of file.
>
> This works well for me up to Nuttx version 10.2.0 but now when I try to
> make I got the errors

I think with NuttX 10.2.0 you do not need to perform the next steps any more.

   *Rename src/Make.defs to src/Makefile and append the line *
   include $(TOPDIR)/boards/Board.mk at the end of file.

I will get back to errors met by Jukka to see what caused the problem
in his case.

Best regards,
Petro

чт, 3 бер. 2022 р. о 10:12 Abdelatif Guettouche
<abdelatif.guettou...@gmail.com> пише:
>
> > It seems like Daniel is hitting the same issue
>
> Daniel is actually not using the common folder from the STM32
> directory.  This is why he had to do that renaming.
> The issue is this:
> https://github.com/apache/incubator-nuttx/blob/master/tools/Config.mk#L154-L156
> Which is forcing a common directory when there isn't one. This should
> not be done as people have requested before to be able to use boards
> without a common directory even if in-tree we use the common
> directory.
> Daniel, you can just remove those lines to confirm that it builds fine
> (I tried and it does, at least you don't have that error anymore,
> there are some trivial compile errors though in the board).
> For a final solution I think we can either remove them completely or
> just add an else statement. I didn't have time to think about it.
>
> On Thu, Mar 3, 2022 at 9:34 AM Jukka Laitinen <jukka.laiti...@iki.fi> wrote:
> >
> > Hi,
> >
> > Maybe I was jumping in to conclusion and the issue is not the same as
> > what I had. I was building PX4, which uses CMake build system, so I am
> > not having any Makefile or Make.defs in my own board directory. Also the
> > platform is not stm or arm, but risc-v.
> >
> > Anyhow, this is the error which I started getting in my build scripts:
> >
> > "
> >
> > ninja: error:
> > '../../platforms/nuttx/NuttX/nuttx/arch/risc-v/include/board', needed by
> > 'NuttX/nuttx_copy.stamp', missing and no known rule to make it
> > make: *** [Makefile:225: ssrc_icicle_default] Error 1
> > "
> >
> > My configs are:
> >
> > CONFIG_ARCH="risc-v"
> > CONFIG_ARCH_BOARD_CUSTOM=y
> > CONFIG_ARCH_BOARD_CUSTOM_DIR="../nuttx-config"
> > CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
> > CONFIG_ARCH_BOARD_CUSTOM_NAME="px4"
> >
> > One version, where it fails is available publicly in
> >
> > https://github.com/tiiuae/px4-firmware/ (nuttx is included as a submodule)
> >
> > Building "make ssrc_icicle_default". The board files are in
> > boards/ssrc/icicle/nuttx-config and NuttX cloned in
> > platforms/nuttx/Nuttx/nuttx.
> >
> > I didn't yet start looking into it in detail, what goes wrong, just
> > bisected the nuttx and reverted the commit which broke it for me. I need
> > to look back later to see how to change the off-tree board config to get
> > it back online.
> >
> > Just noticed that the error is somewhat similar, although coming from
> > different build env. But in my case it is likely that I need to adapt
> > the cmake build scripts according to the changes in nuttx.
> >
> > -Jukka
> >
> >
> >
> > On 3.3.2022 9.37, Petro Karashchenko wrote:
> > > Hello Jukka,
> > >
> > > So you experience the same problem as Daniel and reverting the commit 
> > > helps?
> > >
> > > Before f77956a227f1db6ecb44eda3814e7b02aa2187a6 there was no way to
> > > reuse common code from "nuttx/board/...". I'm using a custom board
> > > based on SAME70 and after
> > > https://github.com/apache/incubator-nuttx/pull/4981 I found my code
> > > tree broken. Now the folder structure for "boards/arm/samv7" is the
> > > same as in "boards/arm/stm32". Here is what I did to get it back
> > > running:
> > > 1. Synced "custom-board/scripts/Make.defs" with
> > > "boards/arm/samv7/same70-xplained/scripts/Make.defs"
> > > 2. Renamed "custom-board/src/Makefile" to "custom-board/src/Make.defs"
> > > and synced with "boards/arm/samv7/same70-xplained/src/Make.defs"
> > > 3. Removed files in my code tree that have exactly the same
> > > implementation as files from "boards/arm/samv7/common"
> > >
> > > It seems like Daniel is hitting the same issue, so I expect that
> > > renaming Makefile to Make.defs plus setting "BOARD_STM32_COMMON=n"
> > > should fix the issue without any additional file clean-up.
> > > Please give me feedback if that helps.
> > >
> > > Best regards,
> > > Petro
> > >
> > > чт, 3 бер. 2022 р. о 07:40 Jukka Laitinen <jukka.laiti...@iki.fi> пише:
> > >> HI,
> > >>
> > >> Not sure what is the correct way to fix this, but I reverted:
> > >>
> > >> "
> > >>
> > >> commit f77956a227f1db6ecb44eda3814e7b02aa2187a6
> > >> Author: Petro Karashchenko <petro.karashche...@gmail.com>
> > >> Date:   Wed Jan 19 11:16:11 2022 +0200
> > >>
> > >>       tools: add option to reuse boards common files for custom boards
> > >>
> > >>       Signed-off-by: Petro Karashchenko <petro.karashche...@gmail.com>
> > >> "
> > >>
> > >> Petro, what is the proper way to configure this?
> > >>
> > >> Thanks,
> > >>
> > >> Jukka
> > >>
> > >>
> > >>
> > >> On 3.3.2022 0.06, Daniel Pereira Carvalho wrote:
> > >>
> > >>> Hi guys,
> > >>>
> > >>> I am having problems building custom boards outside of the Nuttx folder
> > >>> tree. Usually I use the following folder structure.
> > >>>
> > >>> |-> apps
> > >>> |-> my-folder
> > >>>      |-> my-apps
> > >>>         |-> custom-app
> > >>>      |-> my-boards
> > >>>         |-> custom-board
> > >>> |-> nuttx
> > >>>
> > >>> To build my apps I just need to create a symbolic link called external
> > >>> inside apps folder. To create a new custom board I start copying a 
> > >>> similar
> > >>> board (e.g nucleo-g431kb) to my-boards folder and make the following 
> > >>> changes
> > >>>
> > >>> *remove from defconfig:*
> > >>> CONFIG_ARCH_BOARD="nucleo-g431kb"
> > >>> CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
> > >>>
> > >>> *add on defconfig:*
> > >>> CONFIG_ARCH_BOARD_CUSTOM=y
> > >>> CONFIG_ARCH_BOARD_CUSTOM_DIR="../my-folder/my-boards/custom-board"
> > >>> CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
> > >>> CONFIG_ARCH_BOARD_CUSTOM_NAME="custom-board"
> > >>>
> > >>> *Rename src/Make.defs to src/Makefile and append the line *
> > >>> include $(TOPDIR)/boards/Board.mk at the end of file.
> > >>>
> > >>> This works well for me up to Nuttx version 10.2.0 but now when I try to
> > >>> make I got the errors
> > >>>
> > >>> make[1]: Entering directory '/home/daniel/nuttx-workspace/nuttx/tools'
> > >>> make[1]: Leaving directory '/home/daniel/nuttx-workspace/nuttx/tools'
> > >>> make[1]: Entering directory '/home/daniel/nuttx-workspace/nuttx/tools'
> > >>> make[1]: Leaving directory '/home/daniel/nuttx-workspace/nuttx/tools'
> > >>> Create version.h
> > >>> make[1]: Entering directory '/home/daniel/nuttx-workspace/nuttx/boards'
> > >>> make[2]: Entering directory
> > >>> '/home/daniel/nuttx-workspace/nuttx/boards/arm/stm32/common'
> > >>> Makefile:23: board/Make.defs: No such file or directory
> > >>> make[2]: *** No rule to make target 'board/Make.defs'.  Stop.
> > >>> make[2]: Leaving directory
> > >>> '/home/daniel/nuttx-workspace/nuttx/boards/arm/stm32/common'
> > >>> make[1]: *** [Makefile:79: context] Error 2
> > >>> make[1]: Leaving directory '/home/daniel/nuttx-workspace/nuttx/boards'
> > >>> make: *** [tools/Unix.mk:425: boards/.context] Error 2
> > >>>
> > >>> Does anyone know how to fix this problem?
> > >>>
> > >>> Thanks
> > >>>
> > >>> Daniel Pereira de Carvalho
> > >>>

Reply via email to