Fix build process to work, implement bootloader that does nothing

This commit is contained in:
Jan-Henrik 2019-08-30 13:07:08 +02:00
parent c728ed9a28
commit 09362032a1
4 changed files with 47 additions and 5 deletions

View file

@ -1,3 +1,13 @@
#include <stm32f10x_conf.h>
#include "stmlib/system/bootloader_utils.h"
using namespace stmlib;
const uint32_t kStartAddress = 0x08001000;
int main(void) {
for(;;) ; //casual chillout
SystemInit();
Uninitialize();
JumpTo(kStartAddress);
}

View file

@ -17,5 +17,5 @@ void GPIO::Init() {
}
void GPIO::Write(GPIO_TypeDef* port, uint16_t pin, bool state) {
GPIO_WriteBit(GPIOB, pin, static_cast<BitAction>(state));
GPIO_WriteBit(port, pin, static_cast<BitAction>(state));
}

View file

@ -32,7 +32,7 @@ DENSITY = md
MEMORY_MODE = flash
# USB = enabled
APPLICATION = TRUE
APPLICATION_SMALL = TRUE
BOOTLOADER = midi2cv_bootloader
# Preferred upload command

View file

@ -1,22 +1,54 @@
#include <stm32f10x_conf.h>
#include "stmlib/system/system_clock.h"
#include "drivers/gpio.h"
using namespace stmlib;
GPIO gpio;
// Default interrupt handlers.
extern "C" {
void NMI_Handler() { }
void HardFault_Handler() {
while (1);
}
void MemManage_Handler() { while (1); }
void BusFault_Handler() { while (1); }
void UsageFault_Handler() { while (1); }
void SVC_Handler() { }
void DebugMon_Handler() { }
void PendSV_Handler() { }
// called every 1ms
void SysTick_Handler() {
}
}
void Init(void) {
//system_clock.Init();
SystemInit();
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x1000);
RCC_APB2PeriphClockCmd(
RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC |
RCC_APB2Periph_TIM1 | RCC_APB2Periph_USART1, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
gpio.Init();
}
int main(void) {
Init();
while (1) {
// hi
gpio.Write(GPIO_PIN(GATE_OUT_1), 1);
gpio.Write(GPIO_PIN(GATE_OUT_2), 0);
gpio.Write(GPIO_PIN(GATE_OUT_3), 1);
gpio.Write(GPIO_PIN(GATE_OUT_4), 0);
}
}