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

BSP incorrectly uses hard-coded FLASH_BASE in HAL startup sequence #148

Closed
terrillmoore opened this issue Mar 17, 2021 · 1 comment
Closed
Assignees
Labels

Comments

@terrillmoore
Copy link
Member

This line:

SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */

incorrectly assumes that the flash vectors are at location zero. This is not true if a stage two bootloader is used. The actual address of the vector table can be easily found and should be used instead of a macro. FLASH_BASE cannot be changed as it's used all over the BSP. The error is not that FLASH_BASE is wrong, but rather that it's being used here.

Same mistake also appears in the templates; but these are not being used (and the source templates could be removed to avoid confusion):

SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */

@terrillmoore terrillmoore self-assigned this Mar 17, 2021
@terrillmoore
Copy link
Member Author

Probably removing templates will speed up compiles, too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant