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

ARC: MWDT: device_states section marked with NOLOAD flag #64268

Closed
kokas-a opened this issue Oct 23, 2023 · 0 comments · Fixed by #65406
Closed

ARC: MWDT: device_states section marked with NOLOAD flag #64268

kokas-a opened this issue Oct 23, 2023 · 0 comments · Fixed by #65406
Assignees
Labels
area: ARC ARC Architecture bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@kokas-a
Copy link

kokas-a commented Oct 23, 2023

Describe the bug
MWDT (2023.06) toolcahin marks section device_states with NOLOAD flag.
This section stays uninitialized while flashing elf on HW board. In case of HSDK board, memory filled with 0xFF after cold start.
In this condition the section filled with 0xFF and all devices has incorrect status.

  • What target platform are you using?
    ARC HSDK board
  • What have you tried to diagnose or workaround this issue?
    1. Filled the section footprint with 0x0 values (before call west flash with openocd runner) -- this has helped
    2. Cleared the section in runtime (like .bss section) -- this has helped
    3. Used different hints to mark the section with PROGBITS flag. In this case memory footprint has initlaized with 0x0 while burning -- this has helped
  • Is this a regression? If yes, have you been able to "git bisect" it to a
    specific commit?
    In earlier zephyr versions there were another section placed after device_states that were marked with PROGBITS flag. Total size of loadable segment overlaped device_states section, thats why it was cleared.
    ...
     [27] datas             PROGBITS        90007a8c 008a8c 000064 01  WA  0   0  4
     [28] device_states     NOBITS          90007af0 008af0 00000c 01  WA  0   0  1
    ...  
     [34] k_heap_area       NOBITS          90007afc 008af0 000000 00  WA  0   0  4
     [35] k_mutex_area      PROGBITS        90007afc 008afc 000014 01 WAo  0   0  4
    ...
    

To Reproduce
Steps to reproduce the behavior:

  1. Build zephyr with MWDT compiler
  2. Make sure device_states marked with NOBITS (readelf -S)
  3. Perform board cold start and make sure that memory filled with 0xff
    openocd -f arc/hsdk/support/openocd.cfg '-c init' '-c targets' -c 'reset halt' -c 'mdb <sect_addr> <sect_size>' -c shutdown
  4. Burn zephyr firnware with west flash

Expected behavior
Zephyr works correct

Environment (please complete the following information):

  • OS: Linux
  • Toolchain ARCMWDT 2023.06

Additional context
Gcc compiler always marks device_states section with PROGBITS, while device ststates variables are uninitialized in compile time.
In common logis this section also should has NOLOAD flag in case of gcc.

@kokas-a kokas-a added the bug The issue is a bug, or the PR is fixing a bug label Oct 23, 2023
@evgeniy-paltsev evgeniy-paltsev added the area: ARC ARC Architecture label Oct 23, 2023
@MaureenHelm MaureenHelm added the priority: low Low impact/importance bug label Oct 24, 2023
kokas-a pushed a commit to kokas-a/zephyr that referenced this issue Nov 17, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states variables
defined as uninitialized. This causes the section marked as NOLOAD section and
OpenOCD does not take it in account while flashing it into board memory.
Finally .device_states variables becomes initialized with garbage from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
kokas-a pushed a commit to kokas-a/zephyr that referenced this issue Nov 17, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
kokas-a pushed a commit to kokas-a/zephyr that referenced this issue Nov 17, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
kokas-a pushed a commit to kokas-a/zephyr that referenced this issue Nov 17, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
kokas-a pushed a commit to kokas-a/zephyr that referenced this issue Nov 20, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
kokas-a pushed a commit to kokas-a/zephyr that referenced this issue Nov 24, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
nashif pushed a commit that referenced this issue Nov 25, 2023
This PR fixes #64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this issue Nov 27, 2023
This PR fixes zephyrproject-rtos/zephyr#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

(cherry picked from commit 4cb194f)

Original-Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
GitOrigin-RevId: 4cb194f
Change-Id: If4eb8d80cbde184057556bf6b8dacdd0bef283c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5060909
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Al Semjonovs <asemjonovs@google.com>
Commit-Queue: Al Semjonovs <asemjonovs@google.com>
tychofrei02 pushed a commit to tychofrei02/zephyr that referenced this issue Nov 29, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
yunheQin pushed a commit to yunheQin/zephyr that referenced this issue Dec 6, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
panxxhub pushed a commit to panxxhub/zephyr that referenced this issue Dec 7, 2023
This PR fixes zephyrproject-rtos#64268

MWDT supposes .device_states section as BSS because .device_states
variables defined as uninitialized. This causes the section marked
as NOLOAD section and OpenOCD does not take it in account while
flashing it into board memory.
Finally .device_states variables becomes initialized with garbage
from RAM.

In this PR it's suggested to clean .device_states in early init stage.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARC ARC Architecture bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants