-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix[RL78 Port] Incorrect register image for pvParameters in FAR mode (#1316) #1317
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
Fix[RL78 Port] Incorrect register image for pvParameters in FAR mode (#1316) #1317
Conversation
|
@KeitaKashima What do you think about this change? |
|
@aggarg san
My team will check the code. Could you please have some time to check it in about one or two weeks? |
|
@KeitaKashima Of course. Take your time. Thank you for your help with the review! |
|
@aggarg @TakeoTakahashi2020 and @ShunichiroNakamura of my team members, will check and answer the result. |
|
@KeitaKashima No worries at all! Please take your time. |
|
@ShunichiroNakamura and @TakeoTakahashi2020, thank you for reviewing the code. @sauleThsQuin Would you please address the comments? |
4898f93 to
1612072
Compare
|
@aggarg |
|
@ShunichiroNakamura Thank you so much! @sauleThsQuin The diff shows changes in a lot of unrelated files. Would you please fix them so that we can merge the PR? |
1612072 to
48794de
Compare
…FreeRTOS#1316) In the RL78 FAR data model, pxPortInitialiseStack() did not initialize the register image for the task parameter (pvParameters) correctly. A:DE registers were saved with dummy values instead of the actual pointer. Effect: on first context restore the function prologue read a corrupted parameter. NEAR builds were not affected. This patch aligns the FAR path with the calling convention and compiler version: - IAR V2: pass pvParameters via registers → DE = low 16 bits, A = high 8 - IAR V1 (fallback): keep legacy stack write Also keeps the original stack-frame layout and updates the comment to reflect that pointer sizes depend on __DATA_MODEL__. Result: tasks in FAR receive the correct parameter at entry; NEAR remains unchanged.
88e8962 to
3453311
Compare
|
|
Thanks for the reviews and feedback. |



Title
fix[RL78 Port] incorrect register image for pvParameters in FAR mode (#1316)
Description
In the RL78 FAR data model, pxPortInitialiseStack() did not correctly
initialize the register image in the task stack for the parameter (pvParameters).
The saved A:DE registers were filled with dummy values instead of the actual pointer value.
As a result, when the first context restore occurred, the compiler's function prologue read a corrupted parameter from the register image.
This only affected FAR builds; NEAR model was not impacted.
This patch updates the RL78 FAR path so that the register image matches the RL78 calling convention:
DE = low 16 bits of pvParameters
A = high 8 bits of pvParameters (via AX register image, X = 0)
With this change, tasks in FAR model receive the correct parameter at entry, while NEAR model remains unchanged.
Test Steps
Before fix: value corrupted (dummy registers A:DE = 0x1111/0xDEDE).
After fix: value matches the pointer passed to xTaskCreate.
Confirm no regression with NEAR model build.
Checklist
I have tested my changes. No regression in existing tests.
I have modified and/or added unit-tests to cover the code changes in this Pull Request.
Related Issue
#1316