nuttx-apps icon indicating copy to clipboard operation
nuttx-apps copied to clipboard

feature: implement simple spinlock test

Open TaiJuWu opened this issue 1 year ago • 9 comments

Summary

feature: implement simple spinlock test

Two threads use share variable and the variable should be same as excepted.

Impact

ostest if config spinlock

Testing

./tools/configure.sh -l qemu-armv8a:nsh_smp ostest

sim:ostest

TaiJuWu avatar Sep 20 '23 09:09 TaiJuWu

please fix:

====================================================================================
Configuration/Tool: esp32s3-devkit/ksta_softap
------------------------------------------------------------------------------------
  Cleaning...
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
  Configuring...
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
  Building NuttX...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  340k  100  340k    0     0  1044k      0 --:--:-- --:--:-- --:--:-- 1044k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  496k  100  496k    0     0  1872k      0 --:--:-- --:--:-- --:--:-- 5169k
xtensa-esp32s3-elf-ld: /github/workspace/sources/nuttx/staging//libapps.a(spinlock.c.github.workspace.sources.apps.testing.ostest.o):(.literal.thread_native_spinlock+0x10): undefined reference to `spin_lock'
xtensa-esp32s3-elf-ld: /github/workspace/sources/nuttx/staging//libapps.a(spinlock.c.github.workspace.sources.apps.testing.ostest.o): in function `thread_native_spinlock':
spinlock.c:(.text.thread_native_spinlock+0x1b): undefined reference to `spin_lock'
make[1]: *** [Makefile:82: nuttx_user.elf] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [tools/Unix.mk:526: nuttx] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 370: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  Normalize esp32s3-devkit/ksta_softap

xiaoxiang781216 avatar Sep 21 '23 02:09 xiaoxiang781216

please fix:

====================================================================================
Configuration/Tool: esp32s3-devkit/ksta_softap
------------------------------------------------------------------------------------
  Cleaning...
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
  Configuring...
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
  Building NuttX...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  340k  100  340k    0     0  1044k      0 --:--:-- --:--:-- --:--:-- 1044k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  496k  100  496k    0     0  1872k      0 --:--:-- --:--:-- --:--:-- 5169k
xtensa-esp32s3-elf-ld: /github/workspace/sources/nuttx/staging//libapps.a(spinlock.c.github.workspace.sources.apps.testing.ostest.o):(.literal.thread_native_spinlock+0x10): undefined reference to `spin_lock'
xtensa-esp32s3-elf-ld: /github/workspace/sources/nuttx/staging//libapps.a(spinlock.c.github.workspace.sources.apps.testing.ostest.o): in function `thread_native_spinlock':
spinlock.c:(.text.thread_native_spinlock+0x1b): undefined reference to `spin_lock'
make[1]: *** [Makefile:82: nuttx_user.elf] Error 1
make[1]: Target 'all' not remade because of errors.
make: *** [tools/Unix.mk:526: nuttx] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 370: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  Normalize esp32s3-devkit/ksta_softap

The error is related about nuttx repo setting. I disable spinlock config, I think it just a temporary solution.

TaiJuWu avatar Sep 21 '23 11:09 TaiJuWu

has more need fix? @TaiJuWu

xiaoxiang781216 avatar Sep 22 '23 01:09 xiaoxiang781216

has more need fix? @TaiJuWu

No. Just this PR.

TaiJuWu avatar Sep 22 '23 08:09 TaiJuWu

Is there any place which can select linker obj exclude Makefile and CmakeList? After compiling, I can see spinlock.o in nuttx but it doesn't be linked. As I know I just need to set Makefile and CmakeList and then tools can help me to compiler and link them.

TaiJuWu avatar Sep 26 '23 20:09 TaiJuWu

Is there any place which can select linker obj exclude Makefile and CmakeList? After compiling, I can see spinlock.o in nuttx but it doesn't be linked. As I know I just need to set Makefile and CmakeList and then tools can help me to compiler and link them.

Does spinlock.o expose spin_lock function?

xiaoxiang781216 avatar Sep 27 '23 02:09 xiaoxiang781216

Is there any place which can select linker obj exclude Makefile and CmakeList? After compiling, I can see spinlock.o in nuttx but it doesn't be linked. As I know I just need to set Makefile and CmakeList and then tools can help me to compiler and link them.

Does spinlock.o expose spin_lock function?

Yes, it doest. The symbol table show below

/home/ubuntu/nuttxSpace/nuttx/sched/spinlock.o:     file format elf64-littleriscv

SYMBOL TABLE:
0000000000000000 l    df *ABS*	0000000000000000 spinlock.c
0000000000000000 l    d  .text	0000000000000000 .text
0000000000000000 l    d  .data	0000000000000000 .data
0000000000000000 l    d  .bss	0000000000000000 .bss
0000000000000000 l    d  .text.spin_lock	0000000000000000 .text.spin_lock
0000000000000000 l    d  .text.spin_lock_wo_note	0000000000000000 .text.spin_lock_wo_note
0000000000000000 l    d  .text.spin_trylock	0000000000000000 .text.spin_trylock
0000000000000000 l    d  .text.spin_trylock_wo_note	0000000000000000 .text.spin_trylock_wo_note
0000000000000000 l    d  .text.spin_unlock	0000000000000000 .text.spin_unlock
0000000000000000 l    d  .text.spin_unlock_wo_note	0000000000000000 .text.spin_unlock_wo_note
0000000000000000 l    d  .text.spin_setbit	0000000000000000 .text.spin_setbit
0000000000000000 l    d  .text.spin_clrbit	0000000000000000 .text.spin_clrbit
0000000000000000 l    d  .debug_info	0000000000000000 .debug_info
0000000000000000 l    d  .debug_abbrev	0000000000000000 .debug_abbrev
0000000000000000 l    d  .debug_loclists	0000000000000000 .debug_loclists
0000000000000000 l    d  .debug_aranges	0000000000000000 .debug_aranges
0000000000000000 l    d  .debug_rnglists	0000000000000000 .debug_rnglists
0000000000000000 l    d  .debug_line	0000000000000000 .debug_line
0000000000000000 l    d  .debug_str	0000000000000000 .debug_str
0000000000000000 l    d  .debug_line_str	0000000000000000 .debug_line_str
0000000000000000 l    d  .comment	0000000000000000 .comment
0000000000000000 l    d  .debug_frame	0000000000000000 .debug_frame
0000000000000000 l    d  .riscv.attributes	0000000000000000 .riscv.attributes
0000000000000000 g     F .text.spin_lock	000000000000002e spin_lock
0000000000000000         *UND*	0000000000000000 up_testset
0000000000000000 g     F .text.spin_lock_wo_note	0000000000000008 spin_lock_wo_note
0000000000000000 g     F .text.spin_trylock	0000000000000024 spin_trylock
0000000000000000 g     F .text.spin_trylock_wo_note	0000000000000008 spin_trylock_wo_note
0000000000000000 g     F .text.spin_unlock	000000000000000e spin_unlock
0000000000000000 g     F .text.spin_unlock_wo_note	0000000000000008 spin_unlock_wo_note
0000000000000000 g     F .text.spin_setbit	000000000000005a spin_setbit
0000000000000000 g     F .text.spin_clrbit	0000000000000062 spin_clrbit

TaiJuWu avatar Sep 27 '23 08:09 TaiJuWu

it's strange that linker can't find it.

xiaoxiang781216 avatar Sep 28 '23 01:09 xiaoxiang781216

strange

Yes, so I think is there any place which should be set?

TaiJuWu avatar Sep 28 '23 02:09 TaiJuWu

@TaiJuWu do you plan to fix the conflicts and merge this PR, or can we close it?

acassis avatar Apr 29 '24 20:04 acassis

@TaiJuWu do you plan to fix the conflicts and merge this PR, or can we close it?

I am not working on this, close it.

TaiJuWu avatar Apr 29 '24 21:04 TaiJuWu