We need to set a GPIO pin in MCUBoot to activate an external USB hub chip so the USB DFU will work. I would like to do this with code in our project rather than directly modifying the bootloader code in the NCS directories, so it stays in our version control.
Sigurd shows a clever way to do this in this case: RE: Modify the MCUboot's booting process
Basically, a CMakeLists.txt file is added to the board folder that adds a board.c file to the MCUBoot build. And the board.c file is created with a function that initializes the LED pin, and has a SYS_INIT() line to have the init function be called as MCUBoot is starting up.
But the example says to put the make file and board.c file in the boards folder at `zephyr\boards\arm\nrf52840dk_nrf52840\`, and that is also in the NCS folders. We have custom board overlays in a `boards` folder in our own project. That works very well for compiling for a couple different boards we have. But when I put a CMakeLists.txt and board.c file in our local `boards` folder it does not seem to get recognized and the board.c file included in the MCUBoot build.
The build configuration specifies the selected board overlay file under "Base Devicetree overlays", and the device tree is correctly built. But that isn't enough to make the build process look in that folder for the make and C code files.
How can I get this to work? Do I need to add something to the project level CMakeLists.txt file to tell it to look in the local `boards` folder?