-
Notifications
You must be signed in to change notification settings - Fork 0
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
function pointer with pic #3
Comments
Yes, notoriously function pointers are a problem at least with basic forms of PIC and should be avoided. Some globals are a problem also. Dunno if you have read my writeup but here it is: https://techblog.paalijarvi.fi/2022/01/16/portable-position-independent-code-pic-bootloader-and-firmware-for-arm-cortex-m0-and-cortex-m4/ I don't know if these aspects can be solved in a proper way at all. One hack I have heard of was to put the function pointers to a struct and use somehow with that. But I don't remember/know the details. I'm very sorry. |
Thank you for your reply. I found this code repository after reading your article. The article is very well written. |
i am do PIC on Nuttx rtos. just function pointer and some globals var is badaddress, other code is run well, i mark some function pointer,can run well. |
Hello,
I have a writing problem when using pic,
An error occurs when using a pointer to access a function in a global variable. The reason is that the function address in the global variable has been determined, but when using a pointer to access it, pic will not add the offset for me.
If you update the contents of .data during the system initialization phase, you cannot accurately distinguish which ones are absolute addresses and which ones are data.
example:
do ops->b() will get a bad address.
The text was updated successfully, but these errors were encountered: