1
0
forked from me/IronOS

Fix bootloader size

This commit is contained in:
Ben V. Brown
2021-05-04 18:54:09 +10:00
parent bdeb8ef38a
commit b10a65dd74
5 changed files with 104 additions and 116 deletions

View File

@@ -15,7 +15,6 @@
void preRToSInit() { void preRToSInit() {
/* Reset of all peripherals, Initializes the Flash interface and the Systick. /* Reset of all peripherals, Initializes the Flash interface and the Systick.
*/ */
SCB->VTOR = FLASH_BASE; // Set vector table offset
HAL_Init(); HAL_Init();
Setup_HAL(); // Setup all the HAL objects Setup_HAL(); // Setup all the HAL objects
BSPInit(); BSPInit();

View File

@@ -13,13 +13,6 @@
/* #define DATA_IN_ExtSRAM */ /* #define DATA_IN_ExtSRAM */
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */ #endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
#ifndef VECT_TAB_OFFSET
#define VECT_TAB_OFFSET \
0x00004000U /*!< Vector Table base offset field. \
This value must be a multiple of 0x200. */
// We offset this by 0x4000 to because of the bootloader
#endif
/******************************************************************************* /*******************************************************************************
* Clock Definitions * Clock Definitions
*******************************************************************************/ *******************************************************************************/
@@ -90,7 +83,7 @@ void SystemInit(void) {
#ifdef VECT_TAB_SRAM #ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */ SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
#else #else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */ SCB->VTOR = FLASH_BASE | 0x8000; /* Vector Table Relocation in Internal FLASH. */
#endif #endif
} }

View File

@@ -4,11 +4,11 @@
* Created on: 2 May 2021 * Created on: 2 May 2021
* Author: Ralim * Author: Ralim
*/ */
#include "Pins.h"
#include "Setup.h" #include "Setup.h"
#include <stddef.h> #include <stddef.h>
#include <string.h>
#include <stdint.h> #include <stdint.h>
#include "Pins.h" #include <string.h>
#ifndef CORE_DRIVERS_WS2812_H_ #ifndef CORE_DRIVERS_WS2812_H_
#define CORE_DRIVERS_WS2812_H_ #define CORE_DRIVERS_WS2812_H_
@@ -22,8 +22,8 @@
template <uint32_t LED_GPIO, uint16_t LED_PIN, int LED_COUNT> class WS2812 { template <uint32_t LED_GPIO, uint16_t LED_PIN, int LED_COUNT> class WS2812 {
private: private:
uint8_t leds_colors[WS2812_LED_CHANNEL_COUNT * LED_COUNT]; uint8_t leds_colors[WS2812_LED_CHANNEL_COUNT * LED_COUNT];
public:
public:
void led_update() { void led_update() {
__disable_irq(); __disable_irq();
// Bitbang it out as our cpu irq latency is too high // Bitbang it out as our cpu irq latency is too high
@@ -71,8 +71,7 @@ public:
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
} }
((GPIO_TypeDef*) WS2812_GPIO_Port)->BSRR = (uint32_t) WS2812_Pin ((GPIO_TypeDef *)WS2812_GPIO_Port)->BSRR = (uint32_t)WS2812_Pin << 16u;
<< 16u;
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
@@ -105,9 +104,7 @@ public:
__enable_irq(); __enable_irq();
} }
void init(void) { void init(void) { memset(leds_colors, 0, sizeof(leds_colors)); }
memset(leds_colors, 0, sizeof(leds_colors));
}
void led_set_color(size_t index, uint8_t r, uint8_t g, uint8_t b) { void led_set_color(size_t index, uint8_t r, uint8_t g, uint8_t b) {
leds_colors[index * WS2812_LED_CHANNEL_COUNT + 0] = g; leds_colors[index * WS2812_LED_CHANNEL_COUNT + 0] = g;
@@ -122,7 +119,6 @@ public:
leds_colors[index * WS2812_LED_CHANNEL_COUNT + 2] = b; leds_colors[index * WS2812_LED_CHANNEL_COUNT + 2] = b;
} }
} }
}; };
#endif /* CORE_DRIVERS_WS2812_H_ */ #endif /* CORE_DRIVERS_WS2812_H_ */

View File

@@ -127,7 +127,7 @@ CPUFLAGS= -mcpu=cortex-m3 \
-mthumb \ -mthumb \
-mfloat-abi=soft -mfloat-abi=soft
flash_size=128k flash_size=128k
bootldr_size=0x8000 bootldr_size=32k
endif endif
ifeq ($(model),$(ALL_PINE_MODELS)) ifeq ($(model),$(ALL_PINE_MODELS))
$(info Building for Pine64 ) $(info Building for Pine64 )