mirror of https://github.com/rusefi/wideband.git
extracting hardware-specifc CAN from BL (#32)
* extracting hardware-specifc CAN from BL reusing CAN settings between FW and BL moving CRC into better location * spelling M0 stuff as M0 stuff Co-authored-by: rusefillc <sdfsdfqsf2334234234>
This commit is contained in:
parent
17bf809a5f
commit
41105cd29f
|
@ -119,7 +119,11 @@ CSRC = $(ALLCSRC) cfg/board.c
|
|||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
CPPSRC = $(ALLCPPSRC) bootloader.cpp $(SRCDIR)/shared/flash.cpp crc.cpp
|
||||
CPPSRC = $(ALLCPPSRC) \
|
||||
bootloader.cpp \
|
||||
../port_shared.cpp \
|
||||
$(SRCDIR)/shared/flash.cpp \
|
||||
$(SRCDIR)/shared/crc.cpp
|
||||
|
||||
# List ASM source files here.
|
||||
ASMSRC = $(ALLASMSRC)
|
||||
|
@ -129,7 +133,7 @@ ASMXSRC = $(ALLXASMSRC)
|
|||
|
||||
# Inclusion directories.
|
||||
INCDIR = $(CONFDIR) $(ALLINC) $(SRCDIR)/shared/ \
|
||||
../io
|
||||
../io ../..
|
||||
|
||||
# Define C warning options here.
|
||||
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#include "port_shared.h"
|
||||
#include "flash.h"
|
||||
#include "io_pins.h"
|
||||
|
||||
|
@ -37,15 +36,18 @@ void boot_app() {
|
|||
|
||||
const uint32_t* appFlash = __appflash_start__;
|
||||
|
||||
// The reset vector is at offset 4 (second uint32)
|
||||
uint32_t reset_vector = appFlash[1];
|
||||
|
||||
#ifdef STM32F0XX
|
||||
// copy vector table to sram
|
||||
// TODO: use __ram_vectors_size__
|
||||
memcpy(reinterpret_cast<char*>(&__ram_vectors_start__), appFlash, 256);
|
||||
|
||||
// The reset vector is at offset 4 (second uint32)
|
||||
uint32_t reset_vector = appFlash[1];
|
||||
|
||||
// M0 core version, newer cores do same thing a bit nicer
|
||||
// switch to use vectors in ram
|
||||
SYSCFG->CFGR1 |= 3;
|
||||
#endif
|
||||
|
||||
// TODO: is this necessary?
|
||||
//uint32_t app_msp = appLocation[0];
|
||||
|
@ -214,12 +216,6 @@ void RunBootloaderLoop()
|
|||
}
|
||||
}
|
||||
|
||||
static const CANConfig canConfig500 =
|
||||
{
|
||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
||||
CAN_BTR_SJW(0) | CAN_BTR_BRP(5) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
|
||||
};
|
||||
|
||||
THD_WORKING_AREA(waBootloaderThread, 512);
|
||||
THD_FUNCTION(BootloaderThread, arg)
|
||||
{
|
||||
|
|
|
@ -129,9 +129,3 @@ void SetConfiguration(const Configuration& newConfig)
|
|||
sizeof(Configuration)
|
||||
);
|
||||
}
|
||||
|
||||
const CANConfig canConfig500 =
|
||||
{
|
||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
||||
CAN_BTR_SJW(0) | CAN_BTR_BRP(5) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
|
||||
};
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include "port_shared.h"
|
||||
|
||||
// board-specific stuff shared between bootloader and firmware
|
||||
|
||||
const CANConfig canConfig500 =
|
||||
{
|
||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
||||
CAN_BTR_SJW(0) | CAN_BTR_BRP(5) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
|
||||
};
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "hal.h"
|
||||
#include "port_shared.h"
|
||||
|
||||
struct AnalogResult
|
||||
{
|
||||
|
@ -33,4 +34,3 @@ public:
|
|||
Configuration GetConfiguration();
|
||||
void SetConfiguration(const Configuration& newConfig);
|
||||
|
||||
extern const CANConfig canConfig500;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
extern const CANConfig canConfig500;
|
Loading…
Reference in New Issue