Skip to content

Commit 6427994

Browse files
committed
Implement requested changes
1 parent 83a55f6 commit 6427994

File tree

3 files changed

+1
-30
lines changed

3 files changed

+1
-30
lines changed

ports/stm/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ endif
137137
LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-T,$(LD_COMMON) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
138138
LIBS := -lgcc -lc
139139

140-
LDFLAGS += -mthumb $(MCU_FLAGS_$(MCU_SERIES))
141-
142140
# Use toolchain libm if we're not using our own.
143141
ifndef INTERNAL_LIBM
144142
LIBS += -lm

ports/stm/supervisor/internal_flash.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ void supervisor_flash_flush(void) {
202202
#if defined(STM32H7)
203203
for (uint32_t i = 0; i < (sector_size / 32); i++) {
204204
// Note that the STM32H7 HAL interface differs by taking an address, not 64 bit data
205-
// This is because ST's code is written by a large room of chimpanzees
206205
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, sector_start_addr,
207206
(uint32_t)cache_addr) != HAL_OK) {
208207
// error occurred during flash write

ports/stm/supervisor/port.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,6 @@ __attribute__((used, naked)) void Reset_Handler(void) {
8989
__disable_irq();
9090
__set_MSP((uint32_t) &_ld_stack_top);
9191

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-
10892
/* Disable MPU */
10993
ARM_MPU_Disable();
11094

@@ -117,7 +101,6 @@ __attribute__((used, naked)) void Reset_Handler(void) {
117101
// The first number in RBAR is the region number. When searching for a policy, the region with
118102
// the highest number wins. If none match, then the default policy set at enable applies.
119103

120-
// TODO: do I need to subdivide this up?
121104
// Mark all the flash the same until instructed otherwise.
122105
MPU->RBAR = ARM_MPU_RBAR(11, 0x08000000U);
123106
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) {
135118
MPU->RBAR = ARM_MPU_RBAR(15, 0x24000000U);
136119
MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, NO_SUBREGIONS, ARM_MPU_REGION_SIZE_512KB);
137120

138-
// TODO: what is the mask here doing?
139121
/* Enable MPU */
140122
ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
141123

142-
// We're done mucking with memory so enable I cache and D cache
143-
// SCB_EnableDCache();
144-
// SCB_EnableICache();
145-
146124
// Copy all of the data to run from DTCM.
147125
for (uint32_t i = 0; i < ((size_t) &_ld_dtcm_data_size) / 4; i++) {
148126
(&_ld_dtcm_data_destination)[i] = (&_ld_dtcm_data_flash_copy)[i];
@@ -226,8 +204,8 @@ uint32_t *port_stack_get_top(void) {
226204
return &_ld_stack_top;
227205
}
228206

229-
// TODO: what even are these
230207
extern uint32_t _ebss;
208+
231209
// Place the word to save just after our BSS section that gets blanked.
232210
void port_set_saved_word(uint32_t value) {
233211
_ebss = value;
@@ -239,7 +217,6 @@ uint32_t port_get_saved_word(void) {
239217

240218
__attribute__((used)) void MemManage_Handler(void)
241219
{
242-
__ASM volatile ("bkpt");
243220
reset_into_safe_mode(MEM_MANAGE);
244221
while (true) {
245222
asm("nop;");
@@ -248,7 +225,6 @@ __attribute__((used)) void MemManage_Handler(void)
248225

249226
__attribute__((used)) void BusFault_Handler(void)
250227
{
251-
__ASM volatile ("bkpt");
252228
reset_into_safe_mode(MEM_MANAGE);
253229
while (true) {
254230
asm("nop;");
@@ -257,7 +233,6 @@ __attribute__((used)) void BusFault_Handler(void)
257233

258234
__attribute__((used)) void UsageFault_Handler(void)
259235
{
260-
__ASM volatile ("bkpt");
261236
reset_into_safe_mode(MEM_MANAGE);
262237
while (true) {
263238
asm("nop;");
@@ -266,7 +241,6 @@ __attribute__((used)) void UsageFault_Handler(void)
266241

267242
__attribute__((used)) void HardFault_Handler(void)
268243
{
269-
__ASM volatile ("bkpt");
270244
reset_into_safe_mode(HARD_CRASH);
271245
while (true) {
272246
asm("nop;");

0 commit comments

Comments
 (0)