You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/10/07 19:06:23 UTC

(nuttx-apps) branch master updated (dbcc33f30 -> 033b6c8d0)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


    from dbcc33f30 netutils/tftpc: Fix NULL dereference when the WRQ is acknowledged.
     new 4f73de0e2 examples/nxflat: Build the test modules that do build.
     new 1ece0b12b examples/nxflat: Install the modules without a GNU extension.
     new fbd5bc133 examples/nxflat: Fix the checks of the signal test.
     new 033b6c8d0 examples/nxflat: Fix the stack size and the argv[0] check of the task test.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/nxflat/tests/Makefile         | 18 +++++++++++++-----
 examples/nxflat/tests/errno/Makefile   |  3 ++-
 examples/nxflat/tests/hello++/Makefile | 12 ++++++++----
 examples/nxflat/tests/hello/Makefile   |  3 ++-
 examples/nxflat/tests/longjmp/Makefile |  3 ++-
 examples/nxflat/tests/mutex/Makefile   |  3 ++-
 examples/nxflat/tests/pthread/Makefile |  3 ++-
 examples/nxflat/tests/signal/Makefile  |  3 ++-
 examples/nxflat/tests/signal/signal.c  | 23 ++++++++++-------------
 examples/nxflat/tests/struct/Makefile  |  3 ++-
 examples/nxflat/tests/task/Makefile    |  3 ++-
 examples/nxflat/tests/task/task.c      | 22 +++++++---------------
 12 files changed, 54 insertions(+), 45 deletions(-)


(nuttx-apps) 04/04: examples/nxflat: Fix the stack size and the argv[0] check of the task test.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 033b6c8d01e8cc7e686ab2b4e119075d1f158a24
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Tue Oct 6 18:34:40 2026 +0200

    examples/nxflat: Fix the stack size and the argv[0] check of the task test.
    
    The child task had a 512 byte stack.  Its first printf() overflows it and
    overwrites the argument strings at the bottom of the stack, so the child
    saw an empty argv[0].  Use CONFIG_DEFAULT_TASK_STACKSIZE.
    
    With CONFIG_TASK_NAME_SIZE set to 0 the test expected argv[0] to be
    "<noname>".  But argv[0] is always the name given to task_create(); the
    option only limits the copy in the TCB.  Compare with that name in all
    configurations.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 examples/nxflat/tests/task/task.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/examples/nxflat/tests/task/task.c b/examples/nxflat/tests/task/task.c
index 8a208d5aa..82f9d3909 100644
--- a/examples/nxflat/tests/task/task.c
+++ b/examples/nxflat/tests/task/task.c
@@ -41,10 +41,6 @@ static char child_name[] = "child";
 static char child_arg[] = "Hello from your parent!";
 static sem_t g_sem;
 
-#if CONFIG_TASK_NAME_SIZE == 0
-static char no_name[] = "<noname>";
-#endif
-
 /****************************************************************************
  * Privite Functions
  ****************************************************************************/
@@ -68,21 +64,14 @@ int child_task(int argc, char **argv)
     }
   printf("Child: argv[0]=\"%s\"\n", argv[0]);
 
-#if CONFIG_TASK_NAME_SIZE == 0
-  if (strcmp(argv[0], no_name) != 0)
-    {
-      printf("Child: expected argv[0] to be \"%s\"\n", no_name);
-      printf("Child: Exit-ting with status=3\n");
-      exit(3);
-    }
-#else
-  if (strncmp(argv[0], child_name, CONFIG_TASK_NAME_SIZE) != 0)
+  /* argv[0] is the name given to task_create(), whatever the TCB keeps */
+
+  if (strcmp(argv[0], child_name) != 0)
     {
       printf("Child: expected argv[0] to be \"%s\"\n", child_name);
       printf("Child: Exit-ting with status=3\n");
       exit(3);
     }
-#endif
 
   printf("Child: argv[1]=\"%s\"\n", argv[1]);
 
@@ -116,7 +105,10 @@ int main(int argc, char **argv)
 
   child_argv[0] = child_arg;
   child_argv[1] = 0;
-  child_pid = task_create(child_name, 50, 512,
+
+  /* printf() alone overflows a 512 byte stack and overwrites argv */
+
+  child_pid = task_create(child_name, 50, CONFIG_DEFAULT_TASK_STACKSIZE,
                           child_task, (FAR char * const *)child_argv);
   if (child_pid < 0)
     {


(nuttx-apps) 01/04: examples/nxflat: Build the test modules that do build.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 4f73de0e2968b316640760f3cc999b97b6c39605
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Sep 27 10:04:48 2026 +0200

    examples/nxflat: Build the test modules that do build.
    
    The Makefile said "Most of these do no build yet" and built three of the nine.
    Eight build and convert: errno, hello, longjmp, mutex, pthread, signal, struct
    and task.  What had kept most of them out was read-only data reached
    PC-relative, which the tree now compiles GOT-relative.
    
    BUILD_SUBDIRS was assigned but never read, so mutex, pthread and task stayed
    out even where the configuration allowed them.  The conditionals now append to
    SUBDIRS, which the recipes walk.
    
    longjmp is built only where CONFIG_ARCH_SETJMP_H is set.  It imports setjmp()
    and longjmp(), which the firmware exports only when it supplies its own
    implementation; without the guard the kernel link fails on two undefined
    references.
    
    hello++ stays out: two of its four modules convert, the third needs
    R_ARM_TARGET1 from the converter and the fourth needs an iostream.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 examples/nxflat/tests/Makefile | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/examples/nxflat/tests/Makefile b/examples/nxflat/tests/Makefile
index 0f83f5137..814eb1801 100644
--- a/examples/nxflat/tests/Makefile
+++ b/examples/nxflat/tests/Makefile
@@ -22,16 +22,24 @@
 
 include $(APPDIR)/Make.defs
 
-# Most of these do no build yet
-#SUBDIRS	= errno hello hello++ longjmp mutex pthread signal task struct
-SUBDIRS		= errno hello struct
+# hello++ is left out: two of its four modules convert, the third needs
+# R_ARM_TARGET1 from the converter and the fourth needs an iostream.
+
+SUBDIRS		= errno hello signal struct
+
+# longjmp imports setjmp() and longjmp(), which the symbol table exports only
+# where NuttX supplies them itself.
+
+ifeq ($(CONFIG_ARCH_SETJMP_H),y)
+SUBDIRS		+= longjmp
+endif
 
 ifneq ($(CONFIG_DISABLE_PTHREAD),y)
-BUILD_SUBDIRS += mutex pthread
+SUBDIRS		+= mutex pthread
 endif
 
 ifneq ($(CONFIG_ARCH_ADDRENV),y)
-BUILD_SUBDIRS += task
+SUBDIRS		+= task
 endif
 
 NXFLAT_DIR	= $(APPDIR)/examples/nxflat


(nuttx-apps) 02/04: examples/nxflat: Install the modules without a GNU extension.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 1ece0b12bac97da224894b05f5fec4ad859cbb0e
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Sep 27 10:34:22 2026 +0200

    examples/nxflat: Install the modules without a GNU extension.
    
    install -D is GNU's, and creates the leading directories.  The BSD install
    that macOS carries has no such option and fails the build of every module.
    mkdir -p does that part, and the mode stays explicit.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 examples/nxflat/tests/errno/Makefile   |  3 ++-
 examples/nxflat/tests/hello++/Makefile | 12 ++++++++----
 examples/nxflat/tests/hello/Makefile   |  3 ++-
 examples/nxflat/tests/longjmp/Makefile |  3 ++-
 examples/nxflat/tests/mutex/Makefile   |  3 ++-
 examples/nxflat/tests/pthread/Makefile |  3 ++-
 examples/nxflat/tests/signal/Makefile  |  3 ++-
 examples/nxflat/tests/struct/Makefile  |  3 ++-
 examples/nxflat/tests/task/Makefile    |  3 ++-
 9 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/examples/nxflat/tests/errno/Makefile b/examples/nxflat/tests/errno/Makefile
index 43ee63d4e..d115de73c 100644
--- a/examples/nxflat/tests/errno/Makefile
+++ b/examples/nxflat/tests/errno/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/hello++/Makefile b/examples/nxflat/tests/hello++/Makefile
index 3202dd1b9..978b3c862 100644
--- a/examples/nxflat/tests/hello++/Makefile
+++ b/examples/nxflat/tests/hello++/Makefile
@@ -149,16 +149,20 @@ $(BIN3): $(BIN3).r2
 #	$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN1): $(BIN1)
-	$(Q) install -D $(BIN1) $(ROMFS_DIR)/$(BIN1)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN1) $(ROMFS_DIR)/$(BIN1)
 
 $(ROMFS_DIR)/$(BIN2): $(BIN2)
-	$(Q) install -D $(BIN2) $(ROMFS_DIR)/$(BIN2)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN2) $(ROMFS_DIR)/$(BIN2)
 
 $(ROMFS_DIR)/$(BIN3): $(BIN3)
-	$(Q) install -D $(BIN3) $(ROMFS_DIR)/$(BIN3)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN3) $(ROMFS_DIR)/$(BIN3)
 
 #$(ROMFS_DIR)/$(BIN4): $(BIN4)
-#	$(Q) install -D $(BIN4) $(ROMFS_DIR)/$(BIN4)
+#	$(Q) mkdir -p $(ROMFS_DIR)
+#	$(Q) install -m 0755 $(BIN4) $(ROMFS_DIR)/$(BIN4)
 
 install: $(ROMFS_DIR)/$(BIN1) $(ROMFS_DIR)/$(BIN2) $(ROMFS_DIR)/$(BIN3)
 
diff --git a/examples/nxflat/tests/hello/Makefile b/examples/nxflat/tests/hello/Makefile
index c17605095..96b3c0b27 100644
--- a/examples/nxflat/tests/hello/Makefile
+++ b/examples/nxflat/tests/hello/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/longjmp/Makefile b/examples/nxflat/tests/longjmp/Makefile
index d1dfdd6a4..12a7e89dd 100644
--- a/examples/nxflat/tests/longjmp/Makefile
+++ b/examples/nxflat/tests/longjmp/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/mutex/Makefile b/examples/nxflat/tests/mutex/Makefile
index afdfc4966..0facbb638 100644
--- a/examples/nxflat/tests/mutex/Makefile
+++ b/examples/nxflat/tests/mutex/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/pthread/Makefile b/examples/nxflat/tests/pthread/Makefile
index 34eda9330..a699c777a 100644
--- a/examples/nxflat/tests/pthread/Makefile
+++ b/examples/nxflat/tests/pthread/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/signal/Makefile b/examples/nxflat/tests/signal/Makefile
index 0fba33864..0e0248df3 100644
--- a/examples/nxflat/tests/signal/Makefile
+++ b/examples/nxflat/tests/signal/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/struct/Makefile b/examples/nxflat/tests/struct/Makefile
index 463b2c260..402cf1170 100644
--- a/examples/nxflat/tests/struct/Makefile
+++ b/examples/nxflat/tests/struct/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 
diff --git a/examples/nxflat/tests/task/Makefile b/examples/nxflat/tests/task/Makefile
index cb3473d6b..3f6e7b033 100644
--- a/examples/nxflat/tests/task/Makefile
+++ b/examples/nxflat/tests/task/Makefile
@@ -57,7 +57,8 @@ $(BIN): $(BIN).r2
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
 $(ROMFS_DIR)/$(BIN): $(BIN)
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
 
 install: $(ROMFS_DIR)/$(BIN)
 


(nuttx-apps) 03/04: examples/nxflat: Fix the checks of the signal test.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit fbd5bc133bee74afb872781467a2c3f69e496cac
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Tue Oct 6 18:34:40 2026 +0200

    examples/nxflat: Fix the checks of the signal test.
    
    The handler set sigusr2_rcvd for SIGUSR1 and sigusr1_rcvd for SIGUSR2, so
    the first check failed even when the signal arrived.  The last check
    removed the handler, sent SIGUSR2 and then required that the handler ran.
    
    Set the flag of the signal that arrived, and make the last check require
    that the removed handler does not run.  Also name SIGUSR2, not SIGUSR1, in
    the messages of that step.
    
    The test still fails before apache/nuttx#20468: getpid() in a module that
    exec() started returns the pid of its caller, so kill(getpid(), SIGUSR1)
    signals examples/nxflat instead of the module.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 examples/nxflat/tests/signal/signal.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/examples/nxflat/tests/signal/signal.c b/examples/nxflat/tests/signal/signal.c
index 63ee50767..745efa78c 100644
--- a/examples/nxflat/tests/signal/signal.c
+++ b/examples/nxflat/tests/signal/signal.c
@@ -79,12 +79,12 @@ void siguser_action(int signo, siginfo_t *siginfo, void *arg)
   if (signo == SIGUSR1)
     {
       printf("  SIGUSR1 received\n");
-      sigusr2_rcvd = 1;
+      sigusr1_rcvd = 1;
     }
   else if (signo == SIGUSR2)
     {
       printf("  SIGUSR2 received\n");
-      sigusr1_rcvd = 2;
+      sigusr2_rcvd = 1;
     }
   else
     {
@@ -206,22 +206,20 @@ int main(int argc, char **argv)
 
   sigusr2_rcvd = 0;
 
-  /* Remove the siguser_action handler and replace the SIGUSR2
-   * handler with sigusr2_sighandler.
-   */
+  /* Remove the siguser_action handler and restore the old SIGUSR2 action */
 
   printf("Resetting SIGUSR2 signal handler from pid=%d\n", mypid);
 
   status = sigaction(SIGUSR2, &oact2, &act);
   if (status != 0)
     {
-      fprintf(stderr, "Failed to install SIGUSR1 handler, errno=%d\n",
+      fprintf(stderr, "Failed to install SIGUSR2 handler, errno=%d\n",
               errno);
       exit(2);
     }
 
-  printf("Old SIGUSR1 sighandler at %p\n", act.sa_handler);
-  printf("New SIGUSR1 sighandler at %p\n", oact1.sa_handler);
+  printf("Old SIGUSR2 sighandler at %p\n", act.sa_handler);
+  printf("New SIGUSR2 sighandler at %p\n", oact2.sa_handler);
 
   /* Verify that the handler that was removed was siguser_action */
 
@@ -248,15 +246,14 @@ int main(int argc, char **argv)
   usleep(SHORT_DELAY);
   printf("SIGUSR2 killed from pid=%d\n", mypid);
 
-  /* Verify that SIGUSR2 was received */
+  /* Verify that the removed handler did not run */
 
-  if (sigusr2_rcvd == 0)
+  if (sigusr2_rcvd != 0)
     {
-      fprintf(stderr, "SIGUSR2 not received\n");
+      fprintf(stderr, "SIGUSR2 received by a removed handler\n");
       exit(10);
     }
 
-  sigusr2_rcvd = 0;
-
+  printf("Signal test PASSED\n");
   return 0;
 }