Hello Alan

Strange indeed.

What is the contents of your directories
~/pico-sdk/src/common/pico_base_headers/include/
and
~/pico-sdk/src/common/pico_base_headers/include/pico/

The output of ls -l would be nice.

Cheers
Anders




-------- Original Message --------
On Sunday, 01/25/26 at 15:33 Alan C. Assis <[email protected]> wrote:
Hi Anders,

Strange, "it works fine on my machine" TM.

Please see the steps below:

alan@dev:~/nuttxspace/nuttx$ export PICO_SDK_PATH=/home/alan/pico-sdk
alan@dev:~/nuttxspace/nuttx$ ./tools/configure.sh raspberrypi-pico:nsh
alan@dev:~/nuttxspace/nuttx$ make -j
...
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:        152 KB         2 MB      7.42%
            sram:        8312 B       264 KB      3.07%
Generating: nuttx.uf2
Done.


alan@dev:~/nuttxspace/nuttx$ git diff
diff --git a/arch/arm/src/rp2040/boot2/Make.defs
b/arch/arm/src/rp2040/boot2/Make.defs
index d8b376af71..506f5d76a7 100644
--- a/arch/arm/src/rp2040/boot2/Make.defs
+++ b/arch/arm/src/rp2040/boot2/Make.defs
@@ -46,17 +46,18 @@ BOOT2CFLAGS +=
-I$(PICO_SDK_PATH)/src/rp2_common/pico_platform_sections/include
 BOOT2CFLAGS +=
-I$(PICO_SDK_PATH)/src/rp2_common/pico_platform_panic/include
 BOOT2CFLAGS += -Wl,--no-warn-rwx-segments

-$(BOOT_STAGE2).S: %.S: %.bin
-       python3 $(BOOT2DIR)/pad_checksum -s 0xffffffff $< $@
+BOOT2_STAMP := $(TOPDIR)/.boot_stage2.stamp

-$(BOOT_STAGE2).bin: %.bin: %.elf
-       $(OBJCOPY) -Obinary $< $@
+$(BOOT2_STAMP): $(BOOT_STAGE2).elf
+       $(Q) touch $@

 $(BOOT_STAGE2).elf: $(BOOT2SRC)
-       $(Q) touch
$(PICO_SDK_PATH)/src/common/pico_base_headers/include/pico/version.h
-       $(Q) touch
$(PICO_SDK_PATH)/src/common/pico_base_headers/include/pico/config_autogen.h
        $(CC) -nostdlib -T$(ARCHSCRIPT) $(BOOT2CFLAGS) -o $@ $<
-       $(DELFILE)
$(PICO_SDK_PATH)/src/common/pico_base_headers/include/pico/version.h
-       $(DELFILE)
$(PICO_SDK_PATH)/src/common/pico_base_headers/include/pico/config_autogen.h
+
+$(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).*


alan@dev:~/nuttxspace/nuttx$ cd ~/pico-sdk
alan@dev:~/pico-sdk$ git log
commit efe2103f9b28458a1615ff096054479743ade236 (HEAD, tag: 2.0.0)
Author: graham sanderson <[email protected]>
Date:   Thu Aug 8 06:02:04 2024 -0500

    SDK 2.0.0 release

...

BR,

Alan

On Sun, Jan 25, 2026 at 11:02 AM Anders <[email protected]> wrote:

> 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