-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Describe the bug
arc nsim_em and nsim_sem failed in tests/subsys/jwt/library_encoding.
It's caused by the wrong calculation of _timer_int_handler of arcv2_timer0 driver
The address of _timer_int_handler in zephyr.elf and zephyr_prebuilt.elf are different. (It should be same).
In tests/kernel , there are no problems, ,the address of _timer_int_handler in zephyr.elf and zephyr_prebuilt is the same.
I compared the map files of zephyr.elf and zephyr_prebuilt.elf and found there are difference in linking of some functions in libgcc.a
info of zephyr_prebuilt.elf
text 0x0000000000000000 0x1383c
0x0000000000000000 _image_rom_start = .
0x0000000000000000 _image_text_start = .
*(.exc_vector_table)
.exc_vector_table
0x0000000000000000 0x40 arch/arch/arc/core/libarch__arc__core.a(vector_table.c.obj)
0x0000000000000000 _VectorTable
(.exc_vector_table.)
*(.gnu.linkonce.irq_vector_table)
.gnu.linkonce.irq_vector_table
0x0000000000000040 0x10 libzephyr.a(isr_tables.c.obj)
0x0000000000000040 _irq_vector_table
*(.text)
.text 0x0000000000000050 0x378 /opt/zephyr-sdk/sysroots/arc-zephyr-elf/usr/lib/arc-zephyr-elf/6.2.1/em4_dmips/libgcc.a(_udivdi3.o)
0x0000000000000050 __udivdi3
.text 0x00000000000003c8 0xf8 /opt/zephyr-sdk/sysroots/arc-zephyr-elf/usr/lib/em4_dmips/libc.a(lib_a-memcmp-bs-norm.o)
info of zephyr.elf
text 0x0000000000000000 0x138a8
0x0000000000000000 _image_rom_start = .
0x0000000000000000 _image_text_start = .
*(.exc_vector_table)
.exc_vector_table
0x0000000000000000 0x40 arch/arch/arc/core/libarch__arc__core.a(vector_table.c.obj)
0x0000000000000000 _VectorTable
(.exc_vector_table.)
*(.gnu.linkonce.irq_vector_table)
.gnu.linkonce.irq_vector_table
0x0000000000000040 0x10 CMakeFiles/kernel_elf.dir/isr_tables.c.obj
0x0000000000000040 _irq_vector_table
*(.text)
.text 0x0000000000000050 0x30 /opt/zephyr-sdk/sysroots/arc-zephyr-elf/usr/lib/arc-zephyr-elf/6.2.1/em4_dmips/libgcc.a(_millicodethunk_st.o)
0x0000000000000050 __st_r13_to_r25
0x0000000000000054 __st_r13_to_r24
0x0000000000000058 __st_r13_to_r23
0x000000000000005c __st_r13_to_r22
0x0000000000000060 __st_r13_to_r21
0x0000000000000064 __st_r13_to_r20
0x0000000000000068 __st_r13_to_r19
0x000000000000006c __st_r13_to_r18
0x0000000000000070 __st_r13_to_r17
0x0000000000000074 __st_r13_to_r16
0x0000000000000078 __st_r13_to_r15
.text 0x0000000000000080 0x3c /opt/zephyr-sdk/sysroots/arc-zephyr-elf/usr/lib/arc-zephyr-elf/6.2.1/em4_dmips/libgcc.a(_millicodethunk_ret.o)
0x0000000000000080 __ld_r13_to_r25_ret
0x0000000000000084 __ld_r13_to_r24_ret
0x0000000000000088 __ld_r13_to_r23_ret
0x000000000000008c __ld_r13_to_r22_ret
0x0000000000000090 __ld_r13_to_r21_ret
0x0000000000000094 __ld_r13_to_r20_ret
0x0000000000000098 __ld_r13_to_r19_ret
0x000000000000009c __ld_r13_to_r18_ret
0x00000000000000a0 __ld_r13_to_r17_ret
0x00000000000000a4 __ld_r13_to_r16_ret
0x00000000000000a8 __ld_r13_to_r15_ret
0x00000000000000ac __ld_r13_to_r14_ret
.text 0x00000000000000bc 0x378 /opt/zephyr-sdk/sysroots/arc-zephyr-elf/usr/lib/arc-zephyr-elf/6.2.1/em4_dmips/libgcc.a(_udivdi3.o)
0x00000000000000bc __udivdi3
The root cause is unknown,
To Reproduce
Steps to reproduce the behavior:
0. cd tests\subsys\jwt\library_encoding
- mkdir build; cd build
- cmake -DBOARD=nsim_em ..
- make run
- see error
- comapre the value (the first entry)in isr_table.c and the value of _timer_int_handler in zephyr.map.
Expected behavior
If the address caculation is ok. The test will pass as shown below
***** Booting Zephyr OS v1.7.99-15745-g00c0cb066c5f *****
Running test suite lib_jwt_test
===================================================================
starting test - test_jwt
JWT:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJpb3Qtd29yay0xOTk0MTkiLCJleHAiOjE1MzAzMTIwMjYsImlhdCI6MTUzMDMwODQyNn0.VHKDT-dvWW3UDBGokkttP7P6DNDnd4jjz_wLsOvn9RVBoDAAVG1mQnlROPtOHyRTotWzFYf2g02-VyZoh326yDFXM-66U7ycqyUsJdWBZWYqub6iZ17l0hjodoSpZBJqPB6F9c8Q5u9x1gWVw2l2XNASQyTDIZ3db_GiQbx1SYnNtyxsospoKClIebee-EQkcut9jBPNyiKrzZRPuX0xCiPJYTumHdHSp0UPIDIij2hJl_tacXs-hz_ckqT5HZvJPsxgJCeXz3tP7IlgbeGbPFMFmaYNX4UxYD4XS10MPXUK4_qp8wK4EqjT2YBNF7xXi_sjWMj7isc0i0YSIl6_nQ
len: 459
PASS - test_jwt
===================================================================
Test suite lib_jwt_test succeeded
===================================================================
PROJECT EXECUTION SUCCESSFUL
Impact
What impact does this issue have on your progress (e.g., annoyance, showstopper)
Screenshots or console output
If applicable, add a screenshot (drag-and-drop an image), or console logs
(cut-and-paste text and put a code fence (```) before and after, to help
explain the issue.
Environment (please complete the following information):
- OS: (e.g. Linux, MacOS, Windows)
- Toolchain (e.g Zephyr SDK, ...)
- Commit SHA or Version used
Additional context
Add any other context about the problem here.