Skip to content

Conversation

@extinguish
Copy link

@extinguish extinguish commented Nov 28, 2025

Summary

  1. rearrange the elf test directory, make the sub-testcase in separate directory
  2. delete unnecessary generation of mod_symtab.c
  3. make the examples/elf project can work when signal is disabled
  4. avoid interference between different ELFs generated by symtab

this request is depends on apache/nuttx#17397

Impact

mainly affect the examples/elf project, has no impact on other modules

Testing

  1. has passed the ostest:
End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena     4000000  4000000
ordblks         5        4
mxordblk  3e1e5e8  3e70e10
uordblks   17aed0   17aed0
fordblks  3e85130  3e85130

Final memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena     4000000  4000000
ordblks         1        4
mxordblk  3e95de8  3e70e10
uordblks   16a218   17aed0
fordblks  3e95de8  3e85130
user_main: Exiting
ostest_main: Exiting with status 0
stdio_test: Standard I/O Check: fprintf to stderr
  1. elf test
nsh> elf
Initial memory usage: 16416
Registering romdisk at /dev/ram0

Memory Usage after romdisk_register:
  Before:    16416 After:    16480 Change:       64
Mounting ROMFS filesystem at target=/mnt/elf/romfs with source=/dev/ram0

Memory Usage after mount:
  Before:    16480 After:    17776 Change:     1296

****************************************************************************
* Executing errno
****************************************************************************


Memory Usage after exec:
  Before:    17776 After:    22960 Change:     5184
Wait a bit for test completion
Hello, World on stderr
We failed to open "aflav-sautga-ay!" errno is 2
Hello, World on stdout

Memory Usage after program execution:
  Before:    22960 After:    22776 Change:     -184

****************************************************************************
* Executing hello
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    22960 Change:      184
Wait a bit for test completion
Getting ready to say "Hello, world"

Hello, world!
It has been said.

argc	= 1
argv	= 0x1009160
argv[0]	= (0x1009168) "hello"
argv[1]	= 0
Goodbye, world!

Memory Usage after program execution:
  Before:    22960 After:    22776 Change:     -184

****************************************************************************
* Executing signal
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    22984 Change:      208
Wait a bit for test completion
Setting up signal handlers from pid=5
Old SIGUSR1 sighandler at 0
New SIGUSR1 sighandler at 0x2100045d
Old SIGUSR2 sighandler at 0
New SIGUSR2 sighandler at 0x2100045d
Raising SIGUSR1 from pid=5
Kill-ing SIGUSR1 from pid=5
siguser_action: Received signo=10 siginfo=0x1001e88 arg=0
  SIGUSR1 received
siginfo:
  si_signo  = 10
  si_code   = 0
  si_errno  = 4
  si_value  = 0
SIGUSR1 raised from pid=5
SIGUSR1 not received

Memory Usage after program execution:
  Before:    22984 After:    22776 Change:     -208

****************************************************************************
* Executing struct
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    22984 Change:      208
Wait a bit for test completion
Calling getstruct()
getstruct returned 0x21000f7c
  n = 42 (vs 42) PASS
  pn = 0x1008bc8 (vs 0x1008bc8) PASS
 *pn = 87 (vs 87) PASS
  ps = 0x21000f78 (vs 0x21000f78) PASS
  ps->n = 117 (vs 117) PASS
  pf = 0x21000e4d (vs 0x21000e4d) PASS
Calling mystruct->pf()
In dummyfunc() -- PASS
Exit-ing

Memory Usage after program execution:
  Before:    22984 After:    22776 Change:     -208

****************************************************************************
* Executing hello++1
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    22960 Change:      184
Wait a bit for test completion
Hello, World!

Memory Usage after program execution:
  Before:    22960 After:    22776 Change:     -184

****************************************************************************
* Executing hello++2
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    22960 Change:      184
Wait a bit for test completion
main: Started.  Creating MyThingSayer
CThingSayer::CThingSayer: I am!
main: Created MyThingSayer=0x01008a58
main: Calling MyThingSayer->Initialize
CThingSayer::Initialize: When told, I will say 'Hello, World!'
main: Calling MyThingSayer->SayThing
CThingSayer::SayThing: I am now saying 'Hello, World!'
main: Destroying MyThingSayer
CThingSayer::~CThingSayer: I cease to be
CThingSayer::~CThingSayer: I will never say 'Hello, World!' again
main: Returning

Memory Usage after program execution:
  Before:    22960 After:    22776 Change:     -184

****************************************************************************
* Executing hello++3
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    22984 Change:      208
Wait a bit for test completion
CThingSayer::CThingSayer: I am!
main: Started.  MyThingSayer should already exist
main: Calling MyThingSayer.Initialize
CThingSayer::Initialize: When told, I will say 'Hello, World!'
main: Calling MyThingSayer.SayThing
CThingSayer::SayThing: I am now saying 'Hello, World!'
main: Returning.  MyThingSayer should be destroyed

Memory Usage after program execution:
  Before:    22984 After:    22776 Change:     -208

****************************************************************************
* Executing mutex
****************************************************************************


Memory Usage after exec:
  Before:    22776 After:    23016 Change:      240
Wait a bit for test completion
Starting thread 1
Starting thread 2
Stopping threads
	Thread1	Thread2
Loops	11	10
Errors	0	0

Memory Usage after program execution:
  Before:    23016 After:    31416 Change:     8400

****************************************************************************
* Executing pthread
****************************************************************************


Memory Usage after exec:
  Before:    31416 After:    22960 Change:    -8456
Wait a bit for test completion
PARENT: started

PARENT: calling pthread_start with arg=305419896
CHILD: started with arg=305419896
CHILD: returning -2023406815
PARENT child exitted with -2023406815
PARENT returning success


Memory Usage after program execution:
  Before:    22960 After:    27096 Change:     4136

****************************************************************************
* Executing task
****************************************************************************


Memory Usage after exec:
  Before:    27096 After:    23016 Change:    -4080
Wait a bit for test completion
Parent: Started, pid=14
Parent: Calling task_create()
Parent: Waiting for child (pid=20)
Child: execv was successful!
Child: argc=2
Child: argv[0]="child"
Child: argv[1]="Hello from your parent!"
Child: Exit-ting with status=0
Parent: Exit-ing

Memory Usage after program execution:
  Before:    23016 After:    25728 Change:     2712

Memory Usage End-of-Test:
  Before:    25728 After:    25728 Change:        0

anjiahao1 and others added 3 commits November 28, 2025 09:58
rearrange the elf test directory, make the sub-testcase in separate
directory

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
delete the mod_symtab.c generate procedure

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
make the example elf can work with SIGNAL disabled

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
if defined CONFIG_EXAMPLES_ELF and CONFIG_EXAMPLES_MODLUE,
elf will generated BINDIR, so generated symtab will interference.
It supports inputting multiple specified files in mksymtab.sh to
avoid interference.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @extinguish, CI build errors, please fix :-)

====================================================================================
Configuration/Tool: nucleo-h743zi/elf,CONFIG_ARM_TOOLCHAIN_CLANG
2025-11-28 10:31:47
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_CLANG
  Building NuttX...
Error: <inline asm>:5:12: error: Could not find incbin file '../../apps/examples/elf/tests/romfs.img'
    5 |    .incbin "../../apps/examples/elf/tests/romfs.img"
      |            ^
1 error generated.
make[2]: *** [/github/workspace/sources/nuttx/boards/Board.mk:83: stm32_romfs_initialize.o] Error 1
make[2]: Target 'libboard.a' not remade because of errors.
make[1]: *** [Makefile:187: board/libboard.a] Error 2
make[1]: Target 'nuttx' not remade because of errors.
make: *** [tools/Unix.mk:552: nuttx] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize nucleo-h743zi/elf
On branch master
Your branch is up to date with 'origin/master'.

Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testing section is insufficient.

has passed the relative tests

What are these tests and what were the results? With logs please.

@extinguish
Copy link
Author

Thank you @extinguish, CI build errors, please fix :-)

====================================================================================
Configuration/Tool: nucleo-h743zi/elf,CONFIG_ARM_TOOLCHAIN_CLANG
2025-11-28 10:31:47
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_CLANG
  Building NuttX...
Error: <inline asm>:5:12: error: Could not find incbin file '../../apps/examples/elf/tests/romfs.img'
    5 |    .incbin "../../apps/examples/elf/tests/romfs.img"
      |            ^
1 error generated.
make[2]: *** [/github/workspace/sources/nuttx/boards/Board.mk:83: stm32_romfs_initialize.o] Error 1
make[2]: Target 'libboard.a' not remade because of errors.
make[1]: *** [Makefile:187: board/libboard.a] Error 2
make[1]: Target 'nuttx' not remade because of errors.
make: *** [tools/Unix.mk:552: nuttx] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize nucleo-h743zi/elf
On branch master
Your branch is up to date with 'origin/master'.

this is fixed in apache/nuttx#17397,
the current pull request is depends on apache/nuttx#17397, and need to pass CI together

Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once again, list the tests and provide logs

@acassis
Copy link
Contributor

acassis commented Dec 1, 2025

@extinguish Does this error depend on some PR from nuttx kernel repo?

  Building NuttX...
Error: <inline asm>:5:12: error: Could not find incbin file '../../apps/examples/elf/tests/romfs.img'
    5 |    .incbin "../../apps/examples/elf/tests/romfs.img"
      |            ^
1 error generated.

@extinguish
Copy link
Author

@extinguish Does this error depend on some PR from nuttx kernel repo?

  Building NuttX...
Error: <inline asm>:5:12: error: Could not find incbin file '../../apps/examples/elf/tests/romfs.img'
    5 |    .incbin "../../apps/examples/elf/tests/romfs.img"
      |            ^
1 error generated.

yes, it is depends on apache/nuttx#17397

@extinguish
Copy link
Author

The testing section is insufficient.

has passed the relative tests

What are these tests and what were the results? With logs please.

the test result and log is updated at the pull request message

@extinguish
Copy link
Author

Once again, list the tests and provide logs

Ok, is updated at the pull request message section

@linguini1 linguini1 dismissed their stale review December 2, 2025 13:48

Tests provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants