@@ -89,22 +89,6 @@ __attribute__((used, naked)) void Reset_Handler(void) {
89
89
__disable_irq ();
90
90
__set_MSP ((uint32_t ) & _ld_stack_top );
91
91
92
- // TODO: Is any of this commented stuff actually required?
93
-
94
- /* Disable I cache and D cache */
95
- // SCB_DisableICache();
96
- // SCB_DisableDCache(); // this causes an instant hardfault if used
97
-
98
- // #if ((__FPU_PRESENT == 1) && (__FPU_USED == 1))
99
- // SCB->CPACR |= ((3UL << 10*2) | (3UL << 11*2)); /* set CP10, CP11 Full Access */
100
- // #endif /* ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) */
101
-
102
- // /* Disable Systick which might be enabled by bootrom */
103
- // if (SysTick->CTRL & SysTick_CTRL_ENABLE_Msk)
104
- // {
105
- // SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
106
- // }
107
-
108
92
/* Disable MPU */
109
93
ARM_MPU_Disable ();
110
94
@@ -117,7 +101,6 @@ __attribute__((used, naked)) void Reset_Handler(void) {
117
101
// The first number in RBAR is the region number. When searching for a policy, the region with
118
102
// the highest number wins. If none match, then the default policy set at enable applies.
119
103
120
- // TODO: do I need to subdivide this up?
121
104
// Mark all the flash the same until instructed otherwise.
122
105
MPU -> RBAR = ARM_MPU_RBAR (11 , 0x08000000U );
123
106
MPU -> RASR = ARM_MPU_RASR (EXECUTION , ARM_MPU_AP_FULL , NORMAL , NOT_SHAREABLE , CACHEABLE , BUFFERABLE , NO_SUBREGIONS , ARM_MPU_REGION_SIZE_2MB );
@@ -135,14 +118,9 @@ __attribute__((used, naked)) void Reset_Handler(void) {
135
118
MPU -> RBAR = ARM_MPU_RBAR (15 , 0x24000000U );
136
119
MPU -> RASR = ARM_MPU_RASR (EXECUTION , ARM_MPU_AP_FULL , NORMAL , NOT_SHAREABLE , CACHEABLE , BUFFERABLE , NO_SUBREGIONS , ARM_MPU_REGION_SIZE_512KB );
137
120
138
- // TODO: what is the mask here doing?
139
121
/* Enable MPU */
140
122
ARM_MPU_Enable (MPU_CTRL_PRIVDEFENA_Msk );
141
123
142
- // We're done mucking with memory so enable I cache and D cache
143
- // SCB_EnableDCache();
144
- // SCB_EnableICache();
145
-
146
124
// Copy all of the data to run from DTCM.
147
125
for (uint32_t i = 0 ; i < ((size_t ) & _ld_dtcm_data_size ) / 4 ; i ++ ) {
148
126
(& _ld_dtcm_data_destination )[i ] = (& _ld_dtcm_data_flash_copy )[i ];
@@ -226,8 +204,8 @@ uint32_t *port_stack_get_top(void) {
226
204
return & _ld_stack_top ;
227
205
}
228
206
229
- // TODO: what even are these
230
207
extern uint32_t _ebss ;
208
+
231
209
// Place the word to save just after our BSS section that gets blanked.
232
210
void port_set_saved_word (uint32_t value ) {
233
211
_ebss = value ;
@@ -239,7 +217,6 @@ uint32_t port_get_saved_word(void) {
239
217
240
218
__attribute__((used )) void MemManage_Handler (void )
241
219
{
242
- __ASM volatile ("bkpt" );
243
220
reset_into_safe_mode (MEM_MANAGE );
244
221
while (true) {
245
222
asm("nop;" );
@@ -248,7 +225,6 @@ __attribute__((used)) void MemManage_Handler(void)
248
225
249
226
__attribute__((used )) void BusFault_Handler (void )
250
227
{
251
- __ASM volatile ("bkpt" );
252
228
reset_into_safe_mode (MEM_MANAGE );
253
229
while (true) {
254
230
asm("nop;" );
@@ -257,7 +233,6 @@ __attribute__((used)) void BusFault_Handler(void)
257
233
258
234
__attribute__((used )) void UsageFault_Handler (void )
259
235
{
260
- __ASM volatile ("bkpt" );
261
236
reset_into_safe_mode (MEM_MANAGE );
262
237
while (true) {
263
238
asm("nop;" );
@@ -266,7 +241,6 @@ __attribute__((used)) void UsageFault_Handler(void)
266
241
267
242
__attribute__((used )) void HardFault_Handler (void )
268
243
{
269
- __ASM volatile ("bkpt" );
270
244
reset_into_safe_mode (HARD_CRASH );
271
245
while (true) {
272
246
asm("nop;" );
0 commit comments