Skip to content

Initialise RAM interrupt vector tables in SystemInit() for UBLOX_C030 platform #4539

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

Closed
wants to merge 1 commit into from

Conversation

RobMeades
Copy link
Contributor

@RobMeades RobMeades commented Jun 13, 2017

Following PR #4294 some platforms are failing to boot. The problem in the case of the UBLOX_C030 platform (an STM32F4 MCU) is that HAL_InitTick() calls NVIC_SetVector() when the vectors have not yet been copied into RAM (this now happens later in mbed_cpy_nvic()). This results in a write to flash and, potentially, the timer interrupt could go off when the vector has not been initialised. The net result is that the platform does not boot.

This change sets the RAM interrupt vectors up at start of day in SystemInit() for the UBLOX_C030 platform, allowing it to boot reliably. Without this change the platform is dead.

Related: #4532, #4459.

…erwise not done until *after* a call has already been made to NVIC_SetVector() in HAL_InitTick().
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
int *vectors = (int *)SCB->VTOR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this result in copying nvic 2x ? I replied the the issue. Why is HalInit part of SystemInit. Can it be delayed and what would be the implications. We are reviewing this currently

cc @c1728p9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I suppose it would mean that, but an extra copy step is worth it to have my platform boot and I can't see anything wrong with the platform initialising its interrupt vector table in SystemInit(). If there is a proper/tested answer I'm happy for this PR to be dropped; I'm happy to wait a few days for that answer to come about. If anyone wants working code for the UBLOX_C030 platform I will point them to my fix branch in the meantime.

@c1728p9
Copy link
Contributor

c1728p9 commented Jun 13, 2017

#4543 should fix this problem

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 14, 2017

@RobMeades Can you please test the referenced pull request above and confirm it works (close this) ? Thank you

@RobMeades
Copy link
Contributor Author

Confirmed, that works for me, I will close this PR.

@RobMeades RobMeades closed this Jun 14, 2017
@sg- sg- removed the needs: review label Jun 14, 2017
@RobMeades RobMeades deleted the c030_boot_fix branch July 3, 2017 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants