How to migrate a board build from 1.8.x to 1.9.x

For context, I have been working on porting PX4 to a chip/board, having used v1.8.0 as my starting point. I have/had PX4 building and running on the board, and had been working on additional device drivers and features.

I wanted to bump up to 1.9.x (alpha, beta, eventually the final release) to get access to some of the new features and some of the changes in the submodule code that have occurred since I first started working on the port. There have been some substantial improvements in 1.9.x to the file system layout and the build system (thank you to whomever made those changes!) , but I’m trying to understand and make sure all of my board files are getting moved to the new correct locations.

Following what I was seeing in the tree, here are some examples of the many moves I’ve made so far:
/cmake/configs/nuttx_my_board_defult.cmake --> /boards/my/board/default.cmake
/platforms/nuttx/nuttx-configs/my-board ---> /boards/my/board/nuttx-config
(Also modified the format of the above config file to fit the new format/layout)
/ROMFS/px4fmu_common/init.d/rc.myboard --> /boards/my/board/init/rc.board

I’m still having some build issues, and I think maybe I’ve missed some files that should have been moved. So I was wondering if anyone happened to have a more complete/official list of all the board organization and build system changes that were made so that I can ensure all of my board files have moved to the correct locations, and I’ve updated my build system configuration files accordingly.

Trying to keep this topic generic in hopes that it will help others in a similar situation, or at least help people understand all of the changes that were made to these files between 1.8.x and 1.9.x. I’d be happy to convert any conclusions we come to into a wiki entry.

Thank you for your time.

@dagar you can probably answer this one best, thx.

Hi @joshuawhitehead,

It sounds like you’ve got most of it, what’s likely missing is the cmake config changes where you need to specify the board in a structured way. Here’s px4_fmu-v5 as an example.

This will be a continuing process of distilling all the board pieces into a minimal, declarative form (or as close as we can get). The next big change you’ll see soon is converting to compressed NuttX defconfigs, where the defconfig will only contain the non-default values (~100 lines instead of thousands).

Ok, thank you @dagar , that’s reassuring to hear!

I did update, what is now, my default.cmake file to match the new format (which is much improved by the way, thanks), but it’s possible I missed something.

So I guess the more specific build issue I’m hitting right now is that it looks like the nsh_romfsimg.h file that used to live in each board’s nuttx-config, under platforms/nuttx/nuttx-configs/px4fmu-v5/include/ for example, appears to have moved to a common location under platforms/nuttx/Nuttx. It looks like there’s a command in platforms/nuttx/Nuttx/CMakeLists.txt to copy that file over into the build, but I’m getting a failure during the build in the Nuttx apps saying that the file doesn’t exist:

nsh_romfsetc.c:57:12: fatal error: arch/board/nsh_romfsimg.h: No such file or directory
 #  include <arch/board/nsh_romfsimg.h>

Maybe there’s a new/changed parameter or config I’m missing that needs to be set somewhere to make sure that file gets copied over during the build?

There are a couple other things I’ve noticed too, but I’ll leave it there because they may all be related. Thank you for your time.

Edit - clarity

The other part you’re caught in the middle of is a NuttX upgrade (to current 7.28). One of the changes we enabled on the upstream boards is compressed ROMFS. I’d start by comparing your defconfig to the closest upstream board (eg Make sure you do the actual changes through Nuttx menuconfig or qconfig.

make px4_fmu-v5_default qconfig

Ok, interesting.

I’m looking at the 1.9.0-alpha tag right now (-beta wasn’t out when I started this process), and it looks like it’s still pointing to the 7.22+ branch in the PX4/Nuttx github, and my Nuttx changes have been rebased on the same hash of that submodule that it’s pointing to. Has that switched to the 7.28+ branch for the 1.9.0-beta tag? Or will it be for the official release?

Poking through the defconfig now to see if I can spot the config options I need…

Ah, looking at the differences between the alpha and the beta tag on mainline right now and I do see you’re currently doing that upgrade, and I managed to get in the middle of it ;-p

It is still perplexing to me though that the px4_fmu-v5_default target will build successfully in my current tree, but my board target fails with that nsh_romfsimg.h error… I did a full diff of my nsh/defconfig against the fmuv5 one and didn’t notice any differences that “should” have an effect on that, all of the defines related to ROMFS and such were identical, at least compared to the -alpha tag.