Skip to content

Commit

Permalink
stm32f4: re-implement using cmsis device headers
Browse files Browse the repository at this point in the history
This drops the libopencm3 dependency, and adds libusb_stm32 and the cmsis
device headers for the stm32f4.  Functionality mirrors the gd32f4 port.
Support for the stm32f4[01][57] is dropped due to the DMA errata, and
flashing relies on dual bank support.
  • Loading branch information
via committed May 8, 2023
1 parent c88b017 commit 29e7ab7
Show file tree
Hide file tree
Showing 18 changed files with 1,664 additions and 1,249 deletions.
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[submodule "libopencm3"]
path = contrib/libopencm3
url = https://github.com/libopencm3/libopencm3
[submodule "tinycbor"]
path = contrib/tinycbor
url = https://github.com/intel/tinycbor
[submodule "CMSIS"]
path = contrib/CMSIS_5
url = https://github.com/ARM-software/CMSIS_5.git
shallow = true
[submodule "contrib/cmsis_device_f4"]
path = contrib/cmsis_device_f4
url = https://github.com/STMicroelectronics/cmsis_device_f4.git
[submodule "contrib/libusb_stm32"]
path = contrib/libusb_stm32
url = https://github.com/dmitrystu/libusb_stm32.git
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ CFLAGS+=-Isrc/ -Isrc/platforms/common -Wall -Wextra -g -std=c11 -DGIT_DESCRIBE=\
CFLAGS+=-I${TINYCBOR_DIR}/src
LDFLAGS+= -lm -L${OBJDIR} -l:${TINYCBOR_LIB}

OPENCM3_DIR=$(PWD)/contrib/libopencm3

VPATH+=src src/platforms src/platforms/common
DESTOBJS = $(addprefix ${OBJDIR}/, ${OBJS})

$(OBJDIR):
mkdir -p ${OBJDIR}


$(OBJDIR)/%.o: %.s
${AS} -c -o $@ $<

$(OBJDIR)/%.o: %.c
${CC} ${CFLAGS} -MMD -c -o $@ $<

Expand Down
30 changes: 7 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Requires:
- GNU make
- check (for unit tests)

Before trying to compile, make sure to bring in the libopencm3 submodule:
Before trying to compile, make sure to bring in submodules in contrib:
```
git submodule update --init
```
Expand Down Expand Up @@ -250,28 +250,12 @@ scheduling latency), make sure the threads have permissions to be realtime, or
otherwise constrain it to a single cpu.

# Hardware
The current primary hardware platform is an ST Micro STM32F407VGT
microcontroller. There are a few non-production-ready hardware designs
The current supported microcontrollers are the STMicro STM32F427 and GigaDevice
GD32F450/470. There are a few non-production-ready hardware designs
available under https://github.com/via/viaems-boards, though I would recommend
anyone attempting to use those designs contact me. The STM32F4-DISCOVERY board
*can* be used with this firmware, with appropriate extra hardware for vehicle
interfacing.
anyone attempting to use those designs contact me. Details on each platform are
available in the README files in their platform directories.

## [STM32F4](src/platforms/stm32f4/README.md)

## STM32F4
Note: These are subject to change with the next hardware design, which will be
moving to better support a 64 pin chip and more flexible PWM outputs.

System | Pins
--- | ---
Trigger 0 | `PA0`
Trigger 1 | `PA1`
Frequency | `PA0`, `PA1`, `PA2`, `PA3`
Test Trigger | `PB10`, `PB11`
`CANL` | `PB5`
`CANH` | `PB6`
USB | `PA9`, `PA11`, and `PA12`
ADC | `PB12`, `PB13`, `PB14`, and `PB15`
OUT | `PD0`-`PD15`
GPIO | `PE0`-`PE15`
PWM | `PC6`, `PC7`, `PC8`, and `PC9` (currently all fixed at same frequenty)
## [GD32F4](src/platforms/gd32f4/README.md)
1 change: 1 addition & 0 deletions contrib/cmsis_device_f4
Submodule cmsis_device_f4 added at 7ac690
1 change: 0 additions & 1 deletion contrib/libopencm3
Submodule libopencm3 deleted from e9d87a
1 change: 1 addition & 0 deletions contrib/libusb_stm32
Submodule libusb_stm32 added at 9168e2
5 changes: 5 additions & 0 deletions src/platforms/common/ad7888_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ static inline bool adc_response_is_valid(const uint16_t *values) {
return true;
}

/* Not implemented */
static void process_knock_inputs(const uint16_t *values) {
(void)values;
}

#endif
Loading

0 comments on commit 29e7ab7

Please sign in to comment.