-
Couldn't load subscription status.
- Fork 8.1k
soc: esp32c3: fix TLS flash addressing #72642
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
soc: esp32c3: fix TLS flash addressing #72642
Conversation
|
This looks wrong to me -- When initializing a newly allocated TLS block for a new thread, Zephyr copies bits from ROM into the parts of the new block corresponding to the initialized portion and then clears the portion corresponding to the zero-initialized portion. Your patch seems like it will pull random data from RAM starting at the fake I'm betting we can't simply use To check and make sure your fix works, you can try this version of samples/hello_world/src/main.c: |
For the example code, my test was SUCCESS. For esp32c3, after the bootloader bootstrapping,
|
|
@lgl88911 Thanks for testing and confirming it works. I've tested already before submitting this PR to confirm same scenario. @keith-packard I'll check similar entries as such as the |
When TLS is used, `__tdata_start` is PROVIDED by "thread-local-storage.ld" using absolute address, which makes it land in wrong flash address. This causes risc-v startup code to fail during memcpy/memset. This PR overrides `__tdata_start` to use ADDR, which will make sure it is placed in DROM region due to AT keyword. Signed-off-by: Sylvio Alves <[email protected]>
708bbd2 to
584888f
Compare
Fix linking error due undefined tdata entry. After zephyrproject-rtos#72642, tdata could be undefined due to missing TLS check. Fixed zephyrproject-rtos#74852 Signed-off-by: Sylvio Alves <[email protected]>
Fix linking error due undefined tdata entry. After #72642, tdata could be undefined due to missing TLS check. Fixed #74852 Signed-off-by: Sylvio Alves <[email protected]>
Fix linking error due undefined tdata entry. After zephyrproject-rtos#72642, tdata could be undefined due to missing TLS check. Fixed zephyrproject-rtos#74852 (cherry picked from commit ee1b13c) Original-Signed-off-by: Sylvio Alves <[email protected]> GitOrigin-RevId: ee1b13c Change-Id: I489d954e14822ee44b2892b257afaab35724ee9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5653342 Reviewed-by: Ting Shen <[email protected]> Tested-by: ChromeOS Prod (Robot) <[email protected]> Tested-by: Ting Shen <[email protected]> Commit-Queue: Ting Shen <[email protected]>
When TLS is used,
__tdata_startis PROVIDED by"thread-local-storage.ld" using absolute address, which makes it land in wrong flash address. This causes risc-v startup code to fail during memcpy/memset.
This PR overrides
__tdata_startto use ADDR, which will make sure it is placed in DROM region due to AT keyword.Fixes #69708