Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address is not a known kernel object exception with arcmwdt toolchain #35479

Closed
IRISZZW opened this issue May 20, 2021 · 1 comment · Fixed by #35488
Closed

address is not a known kernel object exception with arcmwdt toolchain #35479

IRISZZW opened this issue May 20, 2021 · 1 comment · Fixed by #35488
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Milestone

Comments

@IRISZZW
Copy link
Contributor

IRISZZW commented May 20, 2021

Describe the bug
A clear and concise description of what the bug is.
What have you tried to diagnose or workaround this issue?

To Reproduce
Steps to reproduce the behavior:

  1. export ZEPHYR_TOOLCHAIN_VARIANT=arcmwdt (with mwdt toolchain installed)
  2. export ARCMWDT_TOOLCHAIN_PATH=${METAWARE_HOME}/../..
  3. ./scripts/twister -p nsim_em -W
  4. See error

Logs and console output

Lots similar exceptions like: xxx(address) is not a valid xxx(object)

E: 0x800070d4 is not a valid k_sem
E: address is not a known kernel object
E: syscall z_vrfy_k_sem_take failed check: access denied
E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
E: Current thread: 0x80002a44 (unknown)
E: Halting system
E: 0x80006cb4 is not a valid sample driver
E: address is not a known kernel object
E: syscall z_vrfy_sample_driver_state_set failed check: access denied
E: couldn't start driver interrupts
E:  r0: 0x3  r1: 0x4  r2: 0x4  r3: 0x3
E:  r4: 0x0  r5: 0x0  r6: 0xab  r7: 0x0
E:  r8: 0x0  r9: 0x0 r10: 0x0 r11: 0x0
E: r12: 0x4 r13: 0x80001804  pc: 0x186
E:  blink: 0x180 status32: 0x80186886
E: lp_end: 0x34d2 lp_start: 0x34cc lp_count: 0x0
E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
E: Current thread: 0x80002b58 (unknown)
E: Halting system

Environment (please complete the following information):

  • OS: (Linux)
  • Toolchain (arcmwdt)
  • Commit SHA: aa78a64

Additional context
I use git bisect find this issue is introduced by this commit(@dcpleung ): 8a4d9f7

it seems something broke statically define and initialize a object macro, like: K_SEM_DEFINE, K_MUTEX_DEFINE

@IRISZZW IRISZZW added bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug labels May 20, 2021
@IRISZZW IRISZZW added this to the v2.6.0 milestone May 20, 2021
@IRISZZW
Copy link
Contributor Author

IRISZZW commented May 20, 2021

Let's debug tests/kernel/mutex/mutex_api for example:

$ west build -b nsim_em  tests/kernel/mutex/mutex_api/
$ west flash

-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner arc-nsim
Console now belongs to UART, hit CRTL-] to return to simulator.
*** Booting Zephyr OS build v2.6.0-rc1-249-gbd122e5ea232  ***
Running test suite mutex_api
===================================================================
START - test_mutex_lock_unlock
E: 0x800064b8 is not a valid k_mutex
E: address is not a known kernel object
E: syscall z_vrfy_k_mutex_init failed check: access denied
E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
E: Current thread: 0x80000a48 (test_mutex_lock_unlock)
E: Halting system
Console now belongs to simulator.

kmutex is at address: 0x800064b8
image

then enable verbose with gen_kobject_list.py:

gen_kobject_list.py: symbol 'kmutex' at 0x800050b8 contains 1 object(s)

there is an unexpected offset 0x1400 (0b5120), then check the zephyr_prebuilt.map:

     VMA      LMA     Size Align Out     In      Symbol

80005000 80005000        0     1 priv_stacks_noinit
80005000 80005000        0     1         z_priv_stacks_ram_start = .
80005000 80005000        0     1         . = ALIGN ( 4 )
80005000 80005000        0     1         + = 5120
80005000 80005000        0     1         z_priv_stacks_ram_end = .
80005000 80005000       74     4 datas
80005000 80005000        0     1         __data_ram_start = .

and check the ``:

 priv_stacks_noinit :
 {
 z_priv_stacks_ram_start = .;
# 23 "/SCRATCH2/Watson/zephyrproject/zephyr/include/linker/kobject-priv-stacks.ld"
# 1 "/SCRATCH2/Watson/zephyrproject/zephyr/build/zephyr/include/generated/linker-kobject-prebuilt-priv-stacks.h" 1
# 24 "/SCRATCH2/Watson/zephyrproject/zephyr/include/linker/kobject-priv-stacks.ld" 2

 . = ALIGN(4);
 . += 5120;
# 38 "/SCRATCH2/Watson/zephyrproject/zephyr/include/linker/kobject-priv-stacks.ld"
 z_priv_stacks_ram_end = .;
# 56 "/SCRATCH2/Watson/zephyrproject/zephyr/include/linker/kobject-priv-stacks.ld"
 } > DCCM

it seems . += 5120 not work with arcmwdt toolchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
3 participants