Alan, thanks for the patch to try. However it doesn't work. Here are some 
details.

Original arch/arm/src/rp2040/boot2/Make.defs from NuttX release 12.12 works 
fine for PICO_SDK_PATH pointing to location
/home/user/pico/pico-sdk, where user has read and write permissions. Without 
write permissions on the directory
/home/user/pico/pico-sdk/src/common/pico_base_headers/include the
build fails, essentially with the same error message as if
PICO_SDK_PATH is pointing to /usr/src/pico-sdk:

user@computer:~/path/nuttx_12_12.2040/nuttx$ echo $PICO_SDK_PATH
/usr/src/pico-sdk
user@computer:~/path/nuttx_12_12.2040/nuttx$ make
touch: cannot touch 
'/usr/src/pico-sdk/src/common/pico_base_headers/include/pico/version.h': 
Permission denied
make[1]: *** [chip/boot2/Make.defs:56: rp2040_boot_stage2.elf] Error 1
make: *** [tools/Unix.mk:552: nuttx] Error 2


After modifying nuttx/arch/arm/src/rp2040/boot2/Make.defs according to
Alan's patch in a previous mail, the compilation fails regardless of whether 
PICO_SDK_PATH is pointing to /usr/src/pico-sdk or
/home/user/pico/pico-sdk (with user rw permissions on the complete
tree). The error message is

user@computer:~/path/nuttx_12_12.2040/nuttx$ make
In file included from 
/usr/src/pico-sdk/src/rp2040/pico_platform/include/pico/asm_helper.S:7,
                 from 
/usr/src/pico-sdk/src/rp2040/boot_stage2/boot2_w25q080.S:29:
/usr/src/pico-sdk/src/common/pico_base_headers/include/pico.h:27:10: fatal 
error: pico/version.h: No such file or directory
   27 | #include "pico/version.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [chip/boot2/Make.defs:55: rp2040_boot_stage2.elf] Error 1
make: *** [tools/Unix.mk:552: nuttx] Error 2


Cheers,
Anders








-------- Original Message --------
On Friday, 01/23/26 at 14:10 Alan C. Assis <[email protected]> wrote:
Hi Anders,

Good catch, I think it is abusing touch for a recompilation.

Could you try this alternative option:

...
BOOT2CFLAGS += -Wl,--no-warn-rwx-segments

BOOT2_STAMP := $(TOPDIR)/.boot_stage2.stamp

$(BOOT2_STAMP): $(BOOT_STAGE2).elf
    $(Q) touch $@

$(BOOT_STAGE2).elf: $(BOOT2SRC)
    $(CC) -nostdlib -T$(ARCHSCRIPT) $(BOOT2CFLAGS) -o $@ $<

$(BOOT_STAGE2).S: $(BOOT_STAGE2).bin
    python3 $(BOOT2DIR)/pad_checksum -s 0xffffffff $< $@

$(BOOT_STAGE2).bin: $(BOOT_STAGE2).elf $(BOOT2_STAMP)
    $(OBJCOPY) -Obinary $< $@

EXTRADELFILE = $(BOOT_STAGE2).*

Just remember to replace the 4 spaces with \t (TAB).

Please let me know if it worked for you, then we can change the code to use
it.

BR,

Alan


On Thu, Jan 22, 2026 at 5:44 PM Anders <[email protected]> wrote:

> Building NuttX for rp2040 touches two files below the pico-sdk directory,
> as can be seen in nuttx/arch/arm/src/rp2040/boot2/Make.defs
> Soon after the (empty) files are used they are deleted.
>
> This obviously fails if there is no write access to the directory where it
> tries to write. For instance if one has installed the pico-sdk-src package
> on Debian or Ubuntu.
>
> What is the need for this method? Is it necessary to have write access to
> the pico-sdk tree?
>
> Btw, similar stuff seem to be in other makefiles elsewhere in the NuttX
> source tree.
>
> Anders

Reply via email to