Re: Error when building custom board

2022-03-03 Thread Jukka Laitinen

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  пише:

HI,

Not sure what is the correct way to fix this, but I reverted:

"

commit f77956a227f1db6ecb44eda3814e7b02aa2187a6
Author: Petro Karashchenko 
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, 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



Re: Error when building custom board

2022-03-03 Thread Abdelatif Guettouche
> 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  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  пише:
> >> HI,
> >>
> >> Not sure what is the correct way to fix this, but I reverted:
> >>
> >> "
> >>
> >> commit f77956a227f1db6ecb44eda3814e7b02aa2187a6
> >> Author: Petro Karashchenko 
> >> 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, 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

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
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
 пише:
>
> > 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  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 tha

Re: Error when building custom board

2022-03-03 Thread Abdelatif Guettouche
> "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.

Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will have
a value, whether there is a common directory or not.

On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
 wrote:
>
> 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
>  пише:
> >
> > > 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  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 us

Re: Error when building custom board

2022-03-03 Thread Abdelatif Guettouche
> I think with NuttX 10.2.0 you do not need to perform the next steps any more.

These are necessary when someone is using a custom board without a
common folder copied from a board in-tree that contains a common
folder.

On Thu, Mar 3, 2022 at 11:31 AM Abdelatif Guettouche
 wrote:
>
> > "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.
>
> Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
> tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will have
> a value, whether there is a common directory or not.
>
> On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
>  wrote:
> >
> > 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
> >  пише:
> > >
> > > > 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  
> > > 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 erro

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
If what you are writing is true, then compilation for any board that
does not have a "common" folder at board level should fail. And there
are plenty of boards in NuttX tree that compile without an error (CI
on mainline pass without any problems). I'm not saying that
"BOARD_COMMON_DIR" will not have a value. The case is will that value
be empty or not.

Best regards,
Petro

чт, 3 бер. 2022 р. о 11:32 Abdelatif Guettouche
 пише:
>
> > "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.
>
> Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
> tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will have
> a value, whether there is a common directory or not.
>
> On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
>  wrote:
> >
> > 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
> >  пише:
> > >
> > > > 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  
> > > 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 nee

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
Hi,

There is no problem with that. We just need to copy source files from
NuttX board common to custom board location and add files to
compilation list together with disabling of NuttX board common layer
(set CONFIG_BOARD_STM32_COMMON=n for example with STM32 case).

Or maybe I'm missing the exact use case. If yes, then please describe
it more clearly and I will try to go through it to see if that can be
achieved with the current code tree or not.

Best regards,
Petro

чт, 3 бер. 2022 р. о 11:37 Abdelatif Guettouche
 пише:
>
> > I think with NuttX 10.2.0 you do not need to perform the next steps any 
> > more.
>
> These are necessary when someone is using a custom board without a
> common folder copied from a board in-tree that contains a common
> folder.
>
> On Thu, Mar 3, 2022 at 11:31 AM Abdelatif Guettouche
>  wrote:
> >
> > > "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.
> >
> > Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
> > tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will have
> > a value, whether there is a common directory or not.
> >
> > On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
> >  wrote:
> > >
> > > 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
> > >  пише:
> > > >
> > > > > 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  
> > > > 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_

Re: Error when building custom board

2022-03-03 Thread Abdelatif Guettouche
> If what you are writing is true, then compilation for any board that
> does not have a "common" folder at board level should fail.

No because in-tree this line: BOARD_COMMON_DIR = $(wildcard
$(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)common)
will result on an empty string.

> We just need to copy source files from
> NuttX board common to custom board location and add files to
> compilation list

The thing is that some people won't want to do that.  They don't want
to use the common folder. It could be that they have an old board
where the common folder structure didn't exist at the time and they
don't want to change their structure.

> Or maybe I'm missing the exact use case.

Daniel's use case is the following: Use a custom board copied from an
in-tree board _without_ using the common directory even if one exists.

On Thu, Mar 3, 2022 at 11:43 AM Petro Karashchenko
 wrote:
>
> Hi,
>
> There is no problem with that. We just need to copy source files from
> NuttX board common to custom board location and add files to
> compilation list together with disabling of NuttX board common layer
> (set CONFIG_BOARD_STM32_COMMON=n for example with STM32 case).
>
> Or maybe I'm missing the exact use case. If yes, then please describe
> it more clearly and I will try to go through it to see if that can be
> achieved with the current code tree or not.
>
> Best regards,
> Petro
>
> чт, 3 бер. 2022 р. о 11:37 Abdelatif Guettouche
>  пише:
> >
> > > I think with NuttX 10.2.0 you do not need to perform the next steps any 
> > > more.
> >
> > These are necessary when someone is using a custom board without a
> > common folder copied from a board in-tree that contains a common
> > folder.
> >
> > On Thu, Mar 3, 2022 at 11:31 AM Abdelatif Guettouche
> >  wrote:
> > >
> > > > "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.
> > >
> > > Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
> > > tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will have
> > > a value, whether there is a common directory or not.
> > >
> > > On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
> > >  wrote:
> > > >
> > > > 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
> > > >  пише:
> > > > >
> > > > > > 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 

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
Hi Jukka,

I tried to replicate your case, but failed with:
$ git submodule update --init --recursive
Cloning into 
'/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
path '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'
failed
Failed to clone 'boards/ssrc/saluki-v1'. Retry scheduled
Cloning into 
'/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
path '/home/pkarashchenko$/workspace/px4-firmware/boards/ssrc/saluki-v1'
failed
Failed to clone 'boards/ssrc/saluki-v1' a second time, aborting

Best regards,
Petro

чт, 3 бер. 2022 р. о 09:34 Jukka Laitinen  пише:
>
> 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  пише:
> >> HI,
> >>
> >> Not sure what is the correct way to fix this, but I reverted:
> >>
> >> "
> >>
> >> commit f77956a227f1db6ecb44eda3814e7b02aa2187a6
> >> Author: Petro Karashchenko 
> >> 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, 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 defco

Re: Error when building custom board

2022-03-03 Thread Jukka Laitinen
Hi, sorry about that; you can just remove that submodule, it is not needed to 
re-produce the issue.

- Jukka

Petro Karashchenko kirjoitti torstai 3. maaliskuuta 2022:
> Hi Jukka,
> 
> I tried to replicate your case, but failed with:
> $ git submodule update --init --recursive
> Cloning into 
> '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> ERROR: Repository not found.
> fatal: Could not read from remote repository.
> 
> Please make sure you have the correct access rights
> and the repository exists.
> fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> path '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'
> failed
> Failed to clone 'boards/ssrc/saluki-v1'. Retry scheduled
> Cloning into 
> '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> ERROR: Repository not found.
> fatal: Could not read from remote repository.
> 
> Please make sure you have the correct access rights
> and the repository exists.
> fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> path '/home/pkarashchenko$/workspace/px4-firmware/boards/ssrc/saluki-v1'
> failed
> Failed to clone 'boards/ssrc/saluki-v1' a second time, aborting
> 
> Best regards,
> Petro
> 
> чт, 3 бер. 2022 р. о 09:34 Jukka Laitinen  пише:
> >
> > 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  пише:
> > >> HI,
> > >>
> > >> Not sure what is the correct way to fix this, but I reverted:
> > >>
> > >> "
> > >>
> > >> commit f77956a227f1db6ecb44eda3814e7b02aa2187a6
> > >> Author: Petro Karashchenko 
> > >> 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, 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.
> >

Re: Error when building custom board

2022-03-03 Thread Jukka Laitinen
And also note that the commit I mentioned is already reverted in nuttx 
submodule, so you need to put it back in order to re-produce the issue :)


Jukka Laitinen kirjoitti torstai 3. maaliskuuta 2022:
> Hi, sorry about that; you can just remove that submodule, it is not needed to 
> re-produce the issue.
> 
> - Jukka
> 
> Petro Karashchenko kirjoitti torstai 3. maaliskuuta 2022:
> > Hi Jukka,
> > 
> > I tried to replicate your case, but failed with:
> > $ git submodule update --init --recursive
> > Cloning into 
> > '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> > ERROR: Repository not found.
> > fatal: Could not read from remote repository.
> > 
> > Please make sure you have the correct access rights
> > and the repository exists.
> > fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> > path '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'
> > failed
> > Failed to clone 'boards/ssrc/saluki-v1'. Retry scheduled
> > Cloning into 
> > '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> > ERROR: Repository not found.
> > fatal: Could not read from remote repository.
> > 
> > Please make sure you have the correct access rights
> > and the repository exists.
> > fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> > path '/home/pkarashchenko$/workspace/px4-firmware/boards/ssrc/saluki-v1'
> > failed
> > Failed to clone 'boards/ssrc/saluki-v1' a second time, aborting
> > 
> > Best regards,
> > Petro
> > 
> > чт, 3 бер. 2022 р. о 09:34 Jukka Laitinen  пише:
> > >
> > > 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  пише:
> > > >> HI,
> > > >>
> > > >> Not sure what is the correct way to fix this, but I reverted:
> > > >>
> > > >> "
> > > >>
> > > >> commit f77956a227f1db6ecb44eda3814e7b02aa2187a6
> > > >> Author: Petro Karashchenko 
> > > >> Date:   Wed Jan 19 11:16:11 2022 +0200
> > > >>
> > > >>   tools: add option to reuse boards co

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
Hello Abdelatif,

I just tried to recreate the same scenario. To do this I did:
1. Recreated folder structure as in Daniel's case
|-> apps
|-> my-folder
 |-> my-boards
   |-> custom-board
|-> nuttx

2. Copied  nucleo-g431kb to custom-board: cd my-folder/my-boards && cp
-r ../../nuttx/boards/arm/stm32/nucleo-g431kb custom-board

3. *remove from defconfig:*
CONFIG_ARCH_BOARD="nucleo-g431kb"
CONFIG_ARCH_BOARD_NUCLEO_G431KB=y

4. *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"

5. I did not performed: "*Rename src/Make.defs to src/Makefile and
append the line include $(TOPDIR)/boards/Board.mk at the end of
file.*"

6. tools/configure.sh ../my-folder/my-boards/custom-board/configs/nsh

7. make -j8

Compilation failed, but not because of a common folder but because:
"board/stm32_userleds.c:60:14: error: 'BOARD_LED1' undeclared (first
use in this function); did you mean 'BOARD_LED2'?". So I had to "make
menuconfig" and select "BOARD_CUSTOM_LEDS" to pass compilation
successfully.

"It could be that they have an old board where the common folder
structure didn't exist at the time and they don't want to change their
structure." -- I think this is a weak argument as we change config
option names sometimes as users are forced to adapt their code. The
only miss that I see here is that the
https://github.com/apache/incubator-nuttx/pull/5274 was not marked as
a "breaking change".

Best regards,
Petro

чт, 3 бер. 2022 р. о 11:57 Abdelatif Guettouche
 пише:
>
> > If what you are writing is true, then compilation for any board that
> > does not have a "common" folder at board level should fail.
>
> No because in-tree this line: BOARD_COMMON_DIR = $(wildcard
> $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)common)
> will result on an empty string.
>
> > We just need to copy source files from
> > NuttX board common to custom board location and add files to
> > compilation list
>
> The thing is that some people won't want to do that.  They don't want
> to use the common folder. It could be that they have an old board
> where the common folder structure didn't exist at the time and they
> don't want to change their structure.
>
> > Or maybe I'm missing the exact use case.
>
> Daniel's use case is the following: Use a custom board copied from an
> in-tree board _without_ using the common directory even if one exists.
>
> On Thu, Mar 3, 2022 at 11:43 AM Petro Karashchenko
>  wrote:
> >
> > Hi,
> >
> > There is no problem with that. We just need to copy source files from
> > NuttX board common to custom board location and add files to
> > compilation list together with disabling of NuttX board common layer
> > (set CONFIG_BOARD_STM32_COMMON=n for example with STM32 case).
> >
> > Or maybe I'm missing the exact use case. If yes, then please describe
> > it more clearly and I will try to go through it to see if that can be
> > achieved with the current code tree or not.
> >
> > Best regards,
> > Petro
> >
> > чт, 3 бер. 2022 р. о 11:37 Abdelatif Guettouche
> >  пише:
> > >
> > > > I think with NuttX 10.2.0 you do not need to perform the next steps any 
> > > > more.
> > >
> > > These are necessary when someone is using a custom board without a
> > > common folder copied from a board in-tree that contains a common
> > > folder.
> > >
> > > On Thu, Mar 3, 2022 at 11:31 AM Abdelatif Guettouche
> > >  wrote:
> > > >
> > > > > "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.
> > > >
> > > > Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
> > > > tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will have
> > > > a value, whether there is a common directory or not.
> > > >
> > > > On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
> > > >  wrote:
> > > > >
> > > > > 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_G4

Re: Error when building custom board

2022-03-03 Thread Abdelatif Guettouche
> Compilation failed, but not because of a common folder but because:

Again, the issue is to not use the common folder at all.  This was
requested before.  What you did here is that you used the one in-tree.

> I think this is a weak argument as we change config
option names sometimes as users are forced to adapt their code.

If users are requesting a feature, there isn't a stronger argument.
Besides, this is not even a feature request, this is a restriction
introduced by forcing the common folder to custom boards.
They are called "custom" for a reason, they should not be restricted
in this manner. We should leave the choice of using this folder or not
to the user. As it was before.
If we want to keep the option to share it for both in-tree and
out-of-tree boards, then there has to be an _option_.  Not
unconditionally forced.
One solution is to introduce a new CONFIG_ that defaults to false.




On Thu, Mar 3, 2022 at 1:20 PM Petro Karashchenko
 wrote:
>
> Hello Abdelatif,
>
> I just tried to recreate the same scenario. To do this I did:
> 1. Recreated folder structure as in Daniel's case
> |-> apps
> |-> my-folder
>  |-> my-boards
>|-> custom-board
> |-> nuttx
>
> 2. Copied  nucleo-g431kb to custom-board: cd my-folder/my-boards && cp
> -r ../../nuttx/boards/arm/stm32/nucleo-g431kb custom-board
>
> 3. *remove from defconfig:*
> CONFIG_ARCH_BOARD="nucleo-g431kb"
> CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
>
> 4. *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"
>
> 5. I did not performed: "*Rename src/Make.defs to src/Makefile and
> append the line include $(TOPDIR)/boards/Board.mk at the end of
> file.*"
>
> 6. tools/configure.sh ../my-folder/my-boards/custom-board/configs/nsh
>
> 7. make -j8
>
> Compilation failed, but not because of a common folder but because:
> "board/stm32_userleds.c:60:14: error: 'BOARD_LED1' undeclared (first
> use in this function); did you mean 'BOARD_LED2'?". So I had to "make
> menuconfig" and select "BOARD_CUSTOM_LEDS" to pass compilation
> successfully.
>
> "It could be that they have an old board where the common folder
> structure didn't exist at the time and they don't want to change their
> structure." -- I think this is a weak argument as we change config
> option names sometimes as users are forced to adapt their code. The
> only miss that I see here is that the
> https://github.com/apache/incubator-nuttx/pull/5274 was not marked as
> a "breaking change".
>
> Best regards,
> Petro
>
> чт, 3 бер. 2022 р. о 11:57 Abdelatif Guettouche
>  пише:
> >
> > > If what you are writing is true, then compilation for any board that
> > > does not have a "common" folder at board level should fail.
> >
> > No because in-tree this line: BOARD_COMMON_DIR = $(wildcard
> > $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)common)
> > will result on an empty string.
> >
> > > We just need to copy source files from
> > > NuttX board common to custom board location and add files to
> > > compilation list
> >
> > The thing is that some people won't want to do that.  They don't want
> > to use the common folder. It could be that they have an old board
> > where the common folder structure didn't exist at the time and they
> > don't want to change their structure.
> >
> > > Or maybe I'm missing the exact use case.
> >
> > Daniel's use case is the following: Use a custom board copied from an
> > in-tree board _without_ using the common directory even if one exists.
> >
> > On Thu, Mar 3, 2022 at 11:43 AM Petro Karashchenko
> >  wrote:
> > >
> > > Hi,
> > >
> > > There is no problem with that. We just need to copy source files from
> > > NuttX board common to custom board location and add files to
> > > compilation list together with disabling of NuttX board common layer
> > > (set CONFIG_BOARD_STM32_COMMON=n for example with STM32 case).
> > >
> > > Or maybe I'm missing the exact use case. If yes, then please describe
> > > it more clearly and I will try to go through it to see if that can be
> > > achieved with the current code tree or not.
> > >
> > > Best regards,
> > > Petro
> > >
> > > чт, 3 бер. 2022 р. о 11:37 Abdelatif Guettouche
> > >  пише:
> > > >
> > > > > I think with NuttX 10.2.0 you do not need to perform the next steps 
> > > > > any more.
> > > >
> > > > These are necessary when someone is using a custom board without a
> > > > common folder copied from a board in-tree that contains a common
> > > > folder.
> > > >
> > > > On Thu, Mar 3, 2022 at 11:31 AM Abdelatif Guettouche
> > > >  wrote:
> > > > >
> > > > > > "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

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
The case is only about creating a proper symlink. "Again, the issue is
to not use the common folder at all." -- agin, that is possible. Each
"board/common" has options like "BOARD_STM32_COMMON" or
"BOARD_SAMV7_COMMON" and that is exactly to or not to use in-tree
"board/common". What other option do we need?

"If users are requesting a feature, there isn't a stronger argument."
-- that is absolutely true and that is why I suggest to mark
https://github.com/apache/incubator-nuttx/pull/5274 as a "breaking
change" so users will be aware.
"We should leave the choice of using this folder or not to the user"
-- again, users have a choice over "BOARD_STM32_COMMON" or
"BOARD_SAMV7_COMMON". "BOARD_STM32_COMMON" is defaulted to "n" and I
will make a PR to default all similar options to "n".

Let's discuss new option behavior if existing options do not satisfy a
use cases. I'm open to that, but for now I do not see a need for that
because IMO all options are already inplace.

Abdelatif, I would really appreciate it if you can write and send me
some small proposal at what level the option should exist.

Best regards,
Petro

чт, 3 бер. 2022 р. о 13:48 Abdelatif Guettouche
 пише:
>
> > Compilation failed, but not because of a common folder but because:
>
> Again, the issue is to not use the common folder at all.  This was
> requested before.  What you did here is that you used the one in-tree.
>
> > I think this is a weak argument as we change config
> option names sometimes as users are forced to adapt their code.
>
> If users are requesting a feature, there isn't a stronger argument.
> Besides, this is not even a feature request, this is a restriction
> introduced by forcing the common folder to custom boards.
> They are called "custom" for a reason, they should not be restricted
> in this manner. We should leave the choice of using this folder or not
> to the user. As it was before.
> If we want to keep the option to share it for both in-tree and
> out-of-tree boards, then there has to be an _option_.  Not
> unconditionally forced.
> One solution is to introduce a new CONFIG_ that defaults to false.
>
>
>
>
> On Thu, Mar 3, 2022 at 1:20 PM Petro Karashchenko
>  wrote:
> >
> > Hello Abdelatif,
> >
> > I just tried to recreate the same scenario. To do this I did:
> > 1. Recreated folder structure as in Daniel's case
> > |-> apps
> > |-> my-folder
> >  |-> my-boards
> >|-> custom-board
> > |-> nuttx
> >
> > 2. Copied  nucleo-g431kb to custom-board: cd my-folder/my-boards && cp
> > -r ../../nuttx/boards/arm/stm32/nucleo-g431kb custom-board
> >
> > 3. *remove from defconfig:*
> > CONFIG_ARCH_BOARD="nucleo-g431kb"
> > CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
> >
> > 4. *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"
> >
> > 5. I did not performed: "*Rename src/Make.defs to src/Makefile and
> > append the line include $(TOPDIR)/boards/Board.mk at the end of
> > file.*"
> >
> > 6. tools/configure.sh ../my-folder/my-boards/custom-board/configs/nsh
> >
> > 7. make -j8
> >
> > Compilation failed, but not because of a common folder but because:
> > "board/stm32_userleds.c:60:14: error: 'BOARD_LED1' undeclared (first
> > use in this function); did you mean 'BOARD_LED2'?". So I had to "make
> > menuconfig" and select "BOARD_CUSTOM_LEDS" to pass compilation
> > successfully.
> >
> > "It could be that they have an old board where the common folder
> > structure didn't exist at the time and they don't want to change their
> > structure." -- I think this is a weak argument as we change config
> > option names sometimes as users are forced to adapt their code. The
> > only miss that I see here is that the
> > https://github.com/apache/incubator-nuttx/pull/5274 was not marked as
> > a "breaking change".
> >
> > Best regards,
> > Petro
> >
> > чт, 3 бер. 2022 р. о 11:57 Abdelatif Guettouche
> >  пише:
> > >
> > > > If what you are writing is true, then compilation for any board that
> > > > does not have a "common" folder at board level should fail.
> > >
> > > No because in-tree this line: BOARD_COMMON_DIR = $(wildcard
> > > $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)common)
> > > will result on an empty string.
> > >
> > > > We just need to copy source files from
> > > > NuttX board common to custom board location and add files to
> > > > compilation list
> > >
> > > The thing is that some people won't want to do that.  They don't want
> > > to use the common folder. It could be that they have an old board
> > > where the common folder structure didn't exist at the time and they
> > > don't want to change their structure.
> > >
> > > > Or maybe I'm missing the exact use case.
> > >
> > > Daniel's use case is the following: Use a custom board copied from an
> > > in-tree board _without_ using the common directory even if one exists.

Re: Error when building custom board

2022-03-03 Thread Abdelatif Guettouche
> The case is only about creating a proper symlink.

I think in the current situation the symlink is created unconditionally.

> Abdelatif, I would really appreciate it if you can write and send me
some small proposal at what level the option should exist.

What I was referring to is similar to options like BOARD_STM32_COMMON.
However, I was thinking of having only one that we can use in
different places.  There are other boards, like ESP32, where there is
no similar option. I haven't given this any time, so I don't know how
well it would work.  I'd also be okay with these separate options but
used consistently across all boards and defaulting all to 'n'.
If this keeps the original behavior and as a bonus also removes those
weird steps where we have to rename makefiles, then this is the best
of both worlds.

On Thu, Mar 3, 2022 at 2:01 PM Petro Karashchenko
 wrote:
>
> The case is only about creating a proper symlink. "Again, the issue is
> to not use the common folder at all." -- agin, that is possible. Each
> "board/common" has options like "BOARD_STM32_COMMON" or
> "BOARD_SAMV7_COMMON" and that is exactly to or not to use in-tree
> "board/common". What other option do we need?
>
> "If users are requesting a feature, there isn't a stronger argument."
> -- that is absolutely true and that is why I suggest to mark
> https://github.com/apache/incubator-nuttx/pull/5274 as a "breaking
> change" so users will be aware.
> "We should leave the choice of using this folder or not to the user"
> -- again, users have a choice over "BOARD_STM32_COMMON" or
> "BOARD_SAMV7_COMMON". "BOARD_STM32_COMMON" is defaulted to "n" and I
> will make a PR to default all similar options to "n".
>
> Let's discuss new option behavior if existing options do not satisfy a
> use cases. I'm open to that, but for now I do not see a need for that
> because IMO all options are already inplace.
>
> Abdelatif, I would really appreciate it if you can write and send me
> some small proposal at what level the option should exist.
>
> Best regards,
> Petro
>
> чт, 3 бер. 2022 р. о 13:48 Abdelatif Guettouche
>  пише:
> >
> > > Compilation failed, but not because of a common folder but because:
> >
> > Again, the issue is to not use the common folder at all.  This was
> > requested before.  What you did here is that you used the one in-tree.
> >
> > > I think this is a weak argument as we change config
> > option names sometimes as users are forced to adapt their code.
> >
> > If users are requesting a feature, there isn't a stronger argument.
> > Besides, this is not even a feature request, this is a restriction
> > introduced by forcing the common folder to custom boards.
> > They are called "custom" for a reason, they should not be restricted
> > in this manner. We should leave the choice of using this folder or not
> > to the user. As it was before.
> > If we want to keep the option to share it for both in-tree and
> > out-of-tree boards, then there has to be an _option_.  Not
> > unconditionally forced.
> > One solution is to introduce a new CONFIG_ that defaults to false.
> >
> >
> >
> >
> > On Thu, Mar 3, 2022 at 1:20 PM Petro Karashchenko
> >  wrote:
> > >
> > > Hello Abdelatif,
> > >
> > > I just tried to recreate the same scenario. To do this I did:
> > > 1. Recreated folder structure as in Daniel's case
> > > |-> apps
> > > |-> my-folder
> > >  |-> my-boards
> > >|-> custom-board
> > > |-> nuttx
> > >
> > > 2. Copied  nucleo-g431kb to custom-board: cd my-folder/my-boards && cp
> > > -r ../../nuttx/boards/arm/stm32/nucleo-g431kb custom-board
> > >
> > > 3. *remove from defconfig:*
> > > CONFIG_ARCH_BOARD="nucleo-g431kb"
> > > CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
> > >
> > > 4. *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"
> > >
> > > 5. I did not performed: "*Rename src/Make.defs to src/Makefile and
> > > append the line include $(TOPDIR)/boards/Board.mk at the end of
> > > file.*"
> > >
> > > 6. tools/configure.sh ../my-folder/my-boards/custom-board/configs/nsh
> > >
> > > 7. make -j8
> > >
> > > Compilation failed, but not because of a common folder but because:
> > > "board/stm32_userleds.c:60:14: error: 'BOARD_LED1' undeclared (first
> > > use in this function); did you mean 'BOARD_LED2'?". So I had to "make
> > > menuconfig" and select "BOARD_CUSTOM_LEDS" to pass compilation
> > > successfully.
> > >
> > > "It could be that they have an old board where the common folder
> > > structure didn't exist at the time and they don't want to change their
> > > structure." -- I think this is a weak argument as we change config
> > > option names sometimes as users are forced to adapt their code. The
> > > only miss that I see here is that the
> > > https://github.com/apache/incubator-nuttx/pull/5274 was not marked as
> > > a "breaking change".
> > >
> > > Best r

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
Hi,

"I think in the current situation the symlink is created
unconditionally." -- yes. If the in-tree board has a common folder the
symlink points unconditionally to that location.

Introducing "CONFIG_ARCH_BOARD_COMMON" may be a good option here, so
the user can explicitly specify to create a symlink.

I will think about it a bit more, but most probably will submit a
change introducing "CONFIG_ARCH_BOARD_COMMON".

Best regards,
Petro

чт, 3 бер. 2022 р. о 14:23 Abdelatif Guettouche
 пише:
>
> > The case is only about creating a proper symlink.
>
> I think in the current situation the symlink is created unconditionally.
>
> > Abdelatif, I would really appreciate it if you can write and send me
> some small proposal at what level the option should exist.
>
> What I was referring to is similar to options like BOARD_STM32_COMMON.
> However, I was thinking of having only one that we can use in
> different places.  There are other boards, like ESP32, where there is
> no similar option. I haven't given this any time, so I don't know how
> well it would work.  I'd also be okay with these separate options but
> used consistently across all boards and defaulting all to 'n'.
> If this keeps the original behavior and as a bonus also removes those
> weird steps where we have to rename makefiles, then this is the best
> of both worlds.
>
> On Thu, Mar 3, 2022 at 2:01 PM Petro Karashchenko
>  wrote:
> >
> > The case is only about creating a proper symlink. "Again, the issue is
> > to not use the common folder at all." -- agin, that is possible. Each
> > "board/common" has options like "BOARD_STM32_COMMON" or
> > "BOARD_SAMV7_COMMON" and that is exactly to or not to use in-tree
> > "board/common". What other option do we need?
> >
> > "If users are requesting a feature, there isn't a stronger argument."
> > -- that is absolutely true and that is why I suggest to mark
> > https://github.com/apache/incubator-nuttx/pull/5274 as a "breaking
> > change" so users will be aware.
> > "We should leave the choice of using this folder or not to the user"
> > -- again, users have a choice over "BOARD_STM32_COMMON" or
> > "BOARD_SAMV7_COMMON". "BOARD_STM32_COMMON" is defaulted to "n" and I
> > will make a PR to default all similar options to "n".
> >
> > Let's discuss new option behavior if existing options do not satisfy a
> > use cases. I'm open to that, but for now I do not see a need for that
> > because IMO all options are already inplace.
> >
> > Abdelatif, I would really appreciate it if you can write and send me
> > some small proposal at what level the option should exist.
> >
> > Best regards,
> > Petro
> >
> > чт, 3 бер. 2022 р. о 13:48 Abdelatif Guettouche
> >  пише:
> > >
> > > > Compilation failed, but not because of a common folder but because:
> > >
> > > Again, the issue is to not use the common folder at all.  This was
> > > requested before.  What you did here is that you used the one in-tree.
> > >
> > > > I think this is a weak argument as we change config
> > > option names sometimes as users are forced to adapt their code.
> > >
> > > If users are requesting a feature, there isn't a stronger argument.
> > > Besides, this is not even a feature request, this is a restriction
> > > introduced by forcing the common folder to custom boards.
> > > They are called "custom" for a reason, they should not be restricted
> > > in this manner. We should leave the choice of using this folder or not
> > > to the user. As it was before.
> > > If we want to keep the option to share it for both in-tree and
> > > out-of-tree boards, then there has to be an _option_.  Not
> > > unconditionally forced.
> > > One solution is to introduce a new CONFIG_ that defaults to false.
> > >
> > >
> > >
> > >
> > > On Thu, Mar 3, 2022 at 1:20 PM Petro Karashchenko
> > >  wrote:
> > > >
> > > > Hello Abdelatif,
> > > >
> > > > I just tried to recreate the same scenario. To do this I did:
> > > > 1. Recreated folder structure as in Daniel's case
> > > > |-> apps
> > > > |-> my-folder
> > > >  |-> my-boards
> > > >|-> custom-board
> > > > |-> nuttx
> > > >
> > > > 2. Copied  nucleo-g431kb to custom-board: cd my-folder/my-boards && cp
> > > > -r ../../nuttx/boards/arm/stm32/nucleo-g431kb custom-board
> > > >
> > > > 3. *remove from defconfig:*
> > > > CONFIG_ARCH_BOARD="nucleo-g431kb"
> > > > CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
> > > >
> > > > 4. *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"
> > > >
> > > > 5. I did not performed: "*Rename src/Make.defs to src/Makefile and
> > > > append the line include $(TOPDIR)/boards/Board.mk at the end of
> > > > file.*"
> > > >
> > > > 6. tools/configure.sh ../my-folder/my-boards/custom-board/configs/nsh
> > > >
> > > > 7. make -j8
> > > >
> > > > Compilation failed, but not because of a common folder but because:
> 

Re: Error when building custom board

2022-03-03 Thread Petro Karashchenko
Hello Jukka,

Do you have any steps on how to build or download a docker image that
can be used to build that project?
It takes me too much time to get build running.

Best regards,
Petro

чт, 3 бер. 2022 р. о 12:43 Jukka Laitinen  пише:
>
> And also note that the commit I mentioned is already reverted in nuttx 
> submodule, so you need to put it back in order to re-produce the issue :)
>
>
> Jukka Laitinen kirjoitti torstai 3. maaliskuuta 2022:
> > Hi, sorry about that; you can just remove that submodule, it is not needed 
> > to re-produce the issue.
> >
> > - Jukka
> >
> > Petro Karashchenko kirjoitti torstai 3. maaliskuuta 2022:
> > > Hi Jukka,
> > >
> > > I tried to replicate your case, but failed with:
> > > $ git submodule update --init --recursive
> > > Cloning into 
> > > '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> > > ERROR: Repository not found.
> > > fatal: Could not read from remote repository.
> > >
> > > Please make sure you have the correct access rights
> > > and the repository exists.
> > > fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> > > path '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'
> > > failed
> > > Failed to clone 'boards/ssrc/saluki-v1'. Retry scheduled
> > > Cloning into 
> > > '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> > > ERROR: Repository not found.
> > > fatal: Could not read from remote repository.
> > >
> > > Please make sure you have the correct access rights
> > > and the repository exists.
> > > fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> > > path '/home/pkarashchenko$/workspace/px4-firmware/boards/ssrc/saluki-v1'
> > > failed
> > > Failed to clone 'boards/ssrc/saluki-v1' a second time, aborting
> > >
> > > Best regards,
> > > Petro
> > >
> > > чт, 3 бер. 2022 р. о 09:34 Jukka Laitinen  пише:
> > > >
> > > > 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

Re: NuttX and C++ libraries: boost / ASIO / std::chrono

2022-03-03 Thread Flavio Castro Alves Filho
Hello Petro,

Did you use any specific feature from boost?

Most used features from boost were integrated to newer versions of C++.

I used C++-17 in a project and it worked fine.

Best regards,

Flavio

Em qua., 2 de mar. de 2022 às 11:01, Xiang Xiao
 escreveu:
>
> We use both uClibc++ and libc++, both work fine. But never try the
> boost library.
>
> On Wed, Mar 2, 2022 at 9:16 PM Petro Karashchenko <
> petro.karashche...@gmail.com> wrote:
>
> > Hello team,
> >
> > I would like to ask who has used C++ libraries with NuttX. For example
> > if I have a C++ application that is based on boost and std::chrono
> > then what should be a good way of starting it with NuttX?
> >
> > Best regards,
> > Petro
> >



-- 
Flavio de Castro Alves Filho

flavio.al...@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves


Re: Error when building custom board

2022-03-03 Thread Jukka Laitinen
Hi, sorry but I am away from computer atm.

In the project there is "packaging" subdirectory, it contains some docker env, 
which is also used in TII's CI

- Jukka

Petro Karashchenko kirjoitti torstai 3. maaliskuuta 2022:
> Hello Jukka,
> 
> Do you have any steps on how to build or download a docker image that
> can be used to build that project?
> It takes me too much time to get build running.
> 
> Best regards,
> Petro
> 
> чт, 3 бер. 2022 р. о 12:43 Jukka Laitinen  пише:
> >
> > And also note that the commit I mentioned is already reverted in nuttx 
> > submodule, so you need to put it back in order to re-produce the issue :)
> >
> >
> > Jukka Laitinen kirjoitti torstai 3. maaliskuuta 2022:
> > > Hi, sorry about that; you can just remove that submodule, it is not 
> > > needed to re-produce the issue.
> > >
> > > - Jukka
> > >
> > > Petro Karashchenko kirjoitti torstai 3. maaliskuuta 2022:
> > > > Hi Jukka,
> > > >
> > > > I tried to replicate your case, but failed with:
> > > > $ git submodule update --init --recursive
> > > > Cloning into 
> > > > '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> > > > ERROR: Repository not found.
> > > > fatal: Could not read from remote repository.
> > > >
> > > > Please make sure you have the correct access rights
> > > > and the repository exists.
> > > > fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> > > > path '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'
> > > > failed
> > > > Failed to clone 'boards/ssrc/saluki-v1'. Retry scheduled
> > > > Cloning into 
> > > > '/home/pkarashchenko/workspace/px4-firmware/boards/ssrc/saluki-v1'...
> > > > ERROR: Repository not found.
> > > > fatal: Could not read from remote repository.
> > > >
> > > > Please make sure you have the correct access rights
> > > > and the repository exists.
> > > > fatal: clone of 'g...@github.com:tiiuae/saluki-v1.git' into submodule
> > > > path '/home/pkarashchenko$/workspace/px4-firmware/boards/ssrc/saluki-v1'
> > > > failed
> > > > Failed to clone 'boards/ssrc/saluki-v1' a second time, aborting
> > > >
> > > > Best regards,
> > > > Petro
> > > >
> > > > чт, 3 бер. 2022 р. о 09:34 Jukka Laitinen  пише:
> > > > >
> > > > > 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/sr

Re: CAN3 RX not working, STM32F7

2022-03-03 Thread Oleg
Hi Alan,

Thanks for the participation!

In the end I've dug into the driver code and found the bug with CAN3 filter
configuration.
Here is the fix: https://github.com/apache/incubator-nuttx/pull/5677

---
With best regards, Oleg.

чт, 24 февр. 2022 г. в 23:01, Alan Carvalho de Assis :

> Hi Oleg,
>
> Did you try to find some typo or mistake related to CAN3 in the driver?
>
> Is it possible (at least for test) to use other pin for this signal? i.e.
> PB3.
>
> BR,
>
> Alan
>
> On 2/24/22, Oleg  wrote:
> > Hi all,
> >
> > I'm working with a custom board based on STM32F767 and a custom project
> > fork of px4 based on NuttX-10.2.0. I can successfully configure and use
> > CAN1 and CAN2 buses for sending and receiving messages, but when the CAN3
> > bus is used, the board can only transmit messages, but not receive.
> Simple
> > app that I use for tests just waits in reading from /dev/can2 device.
> >
> > For all CANs the same CAN Bus transceiver is used. I've checked the
> > hardware connection of CAN RX line and MC pin PA8, and I also definitely
> > see data presence at an oscilloscope while data is being received by
> > transceiver, so the issue should be on MC side.
> >
> > GPIO_CAN3_RX is defined to GPIO_CAN3_RX_1 (PA8) in board.h and in debug
> > I've ensured that stm32_configgpio(GPIO_CAN3_RX) is called from
> > stm32_caninitialize() on boot.
> > The firmware should not use other alternative functions of PA8 anywhere
> and
> > I don't see any activity on the line if CAN bus is silent. But anyway
> I've
> > tried to disable Ethernet RMII from defconfing to make sure MCO1 is not
> > used. It didn't help.
> >
> > I don't have any more ideas, maybe someone could help me with suggestions
> > on what I should check to find the cause of my issue.
> > Thanks in advance!
> >
> > ---
> > With best regards, Oleg.
> >
>


Re: Error when building custom board

2022-03-03 Thread Daniel Pereira Carvalho
 Hi Petro,

I forgot to mention that I need to enable BOARD_CUSTOM_LEDS, sorry about
that. Now I was able to build without errors keeping src/Make.defs
untouched.

Thanks everybody

Daniel Pereira de Carvalho


Em qui., 3 de mar. de 2022 às 09:20, Petro Karashchenko <
petro.karashche...@gmail.com> escreveu:

> Hello Abdelatif,
>
> I just tried to recreate the same scenario. To do this I did:
> 1. Recreated folder structure as in Daniel's case
> |-> apps
> |-> my-folder
>  |-> my-boards
>|-> custom-board
> |-> nuttx
>
> 2. Copied  nucleo-g431kb to custom-board: cd my-folder/my-boards && cp
> -r ../../nuttx/boards/arm/stm32/nucleo-g431kb custom-board
>
> 3. *remove from defconfig:*
> CONFIG_ARCH_BOARD="nucleo-g431kb"
> CONFIG_ARCH_BOARD_NUCLEO_G431KB=y
>
> 4. *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"
>
> 5. I did not performed: "*Rename src/Make.defs to src/Makefile and
> append the line include $(TOPDIR)/boards/Board.mk at the end of
> file.*"
>
> 6. tools/configure.sh ../my-folder/my-boards/custom-board/configs/nsh
>
> 7. make -j8
>
> Compilation failed, but not because of a common folder but because:
> "board/stm32_userleds.c:60:14: error: 'BOARD_LED1' undeclared (first
> use in this function); did you mean 'BOARD_LED2'?". So I had to "make
> menuconfig" and select "BOARD_CUSTOM_LEDS" to pass compilation
> successfully.
>
> "It could be that they have an old board where the common folder
> structure didn't exist at the time and they don't want to change their
> structure." -- I think this is a weak argument as we change config
> option names sometimes as users are forced to adapt their code. The
> only miss that I see here is that the
> https://github.com/apache/incubator-nuttx/pull/5274 was not marked as
> a "breaking change".
>
> Best regards,
> Petro
>
> чт, 3 бер. 2022 р. о 11:57 Abdelatif Guettouche
>  пише:
> >
> > > If what you are writing is true, then compilation for any board that
> > > does not have a "common" folder at board level should fail.
> >
> > No because in-tree this line: BOARD_COMMON_DIR = $(wildcard
> >
> $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)common)
> > will result on an empty string.
> >
> > > We just need to copy source files from
> > > NuttX board common to custom board location and add files to
> > > compilation list
> >
> > The thing is that some people won't want to do that.  They don't want
> > to use the common folder. It could be that they have an old board
> > where the common folder structure didn't exist at the time and they
> > don't want to change their structure.
> >
> > > Or maybe I'm missing the exact use case.
> >
> > Daniel's use case is the following: Use a custom board copied from an
> > in-tree board _without_ using the common directory even if one exists.
> >
> > On Thu, Mar 3, 2022 at 11:43 AM Petro Karashchenko
> >  wrote:
> > >
> > > Hi,
> > >
> > > There is no problem with that. We just need to copy source files from
> > > NuttX board common to custom board location and add files to
> > > compilation list together with disabling of NuttX board common layer
> > > (set CONFIG_BOARD_STM32_COMMON=n for example with STM32 case).
> > >
> > > Or maybe I'm missing the exact use case. If yes, then please describe
> > > it more clearly and I will try to go through it to see if that can be
> > > achieved with the current code tree or not.
> > >
> > > Best regards,
> > > Petro
> > >
> > > чт, 3 бер. 2022 р. о 11:37 Abdelatif Guettouche
> > >  пише:
> > > >
> > > > > I think with NuttX 10.2.0 you do not need to perform the next
> steps any more.
> > > >
> > > > These are necessary when someone is using a custom board without a
> > > > common folder copied from a board in-tree that contains a common
> > > > folder.
> > > >
> > > > On Thu, Mar 3, 2022 at 11:31 AM Abdelatif Guettouche
> > > >  wrote:
> > > > >
> > > > > > "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.
> > > > >
> > > > > Unix.mk includes $(TOPDIR)/Make.defs which in its turn includes
> > > > > tools/Config.mk so reaching that Make rule, BOARD_COMMON_DIR will
> have
> > > > > a value, whether there is a common directory or not.
> > > > >
> > > > > On Thu, Mar 3, 2022 at 11:09 AM Petro Karashchenko
> > > > >  wrote:
> > > > > >
> > > > > > 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 dep

Re: CAN3 RX not working, STM32F7

2022-03-03 Thread Alan Carvalho de Assis
Hi Oleg,

I'm glad you figured it out.

BR,

Alan

On 3/3/22, Oleg  wrote:
> Hi Alan,
>
> Thanks for the participation!
>
> In the end I've dug into the driver code and found the bug with CAN3 filter
> configuration.
> Here is the fix: https://github.com/apache/incubator-nuttx/pull/5677
>
> ---
> With best regards, Oleg.
>
> чт, 24 февр. 2022 г. в 23:01, Alan Carvalho de Assis :
>
>> Hi Oleg,
>>
>> Did you try to find some typo or mistake related to CAN3 in the driver?
>>
>> Is it possible (at least for test) to use other pin for this signal? i.e.
>> PB3.
>>
>> BR,
>>
>> Alan
>>
>> On 2/24/22, Oleg  wrote:
>> > Hi all,
>> >
>> > I'm working with a custom board based on STM32F767 and a custom project
>> > fork of px4 based on NuttX-10.2.0. I can successfully configure and use
>> > CAN1 and CAN2 buses for sending and receiving messages, but when the
>> > CAN3
>> > bus is used, the board can only transmit messages, but not receive.
>> Simple
>> > app that I use for tests just waits in reading from /dev/can2 device.
>> >
>> > For all CANs the same CAN Bus transceiver is used. I've checked the
>> > hardware connection of CAN RX line and MC pin PA8, and I also
>> > definitely
>> > see data presence at an oscilloscope while data is being received by
>> > transceiver, so the issue should be on MC side.
>> >
>> > GPIO_CAN3_RX is defined to GPIO_CAN3_RX_1 (PA8) in board.h and in debug
>> > I've ensured that stm32_configgpio(GPIO_CAN3_RX) is called from
>> > stm32_caninitialize() on boot.
>> > The firmware should not use other alternative functions of PA8 anywhere
>> and
>> > I don't see any activity on the line if CAN bus is silent. But anyway
>> I've
>> > tried to disable Ethernet RMII from defconfing to make sure MCO1 is not
>> > used. It didn't help.
>> >
>> > I don't have any more ideas, maybe someone could help me with
>> > suggestions
>> > on what I should check to find the cause of my issue.
>> > Thanks in advance!
>> >
>> > ---
>> > With best regards, Oleg.
>> >
>>
>


SPI Example

2022-03-03 Thread Roberto Bucher

Hi

where can I found a simple example that send n bytes to the SPI and 
receive m bytes?


I can now see the /dev/spi but using simple methods like open and write 
doesn't give me any signal on the bus...


Thanks in advance

Roberto