mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-18 02:53:35 +00:00
hw/bsp/lpc43: configure safe flash timing
This commit is contained in:
@ -59,11 +59,22 @@ void SystemInit(void);
|
||||
// Invoked by startup code
|
||||
void SystemInit(void)
|
||||
{
|
||||
#if defined(__ICCARM__) && !defined(DONT_RESET_ON_RESTART)
|
||||
__disable_irq();
|
||||
#endif
|
||||
|
||||
if (Chip_CREG_OnChipFlashIsPresent()) {
|
||||
// The boot ROM configures flash for its 96 MHz clock, and debugger core
|
||||
// resets can preserve it. Use safe timing before switching the M4 to 204 MHz.
|
||||
Chip_CREG_SetFLASHAccess(FLASHTIM_SAFE_SETTING);
|
||||
__DSB();
|
||||
__ISB();
|
||||
}
|
||||
|
||||
#if defined(__ICCARM__) && !defined(DONT_RESET_ON_RESTART)
|
||||
// A debugger restart resets the M4 core, but can leave LPC43 peripherals and
|
||||
// pending interrupts active. Match the GCC startup sequence, which the IAR
|
||||
// startup lacks, before the C runtime can reuse peripheral DMA memory.
|
||||
__disable_irq();
|
||||
LPC_RGU->RESET_CTRL[0] = 0x10DF1000u;
|
||||
LPC_RGU->RESET_CTRL[1] = 0x01DFF7FFu;
|
||||
for (uint32_t i = 0; i < 8; i++) {
|
||||
|
||||
Reference in New Issue
Block a user