Commit Graph

247 Commits

Author SHA1 Message Date
Andrew Tridgell 61c829d624 HAL_ChibiOS: only use SRAM4 for DMA for now
we can enable others when we have an allocation interface that
specifies the peripheral type
2021-04-07 17:10:45 +10:00
Iampete1 2377d33417 AP_HAL_ChibiOS: H7 set SRAM4 to no cache and allow DMA 2021-04-07 17:10:45 +10:00
Andrew Tridgell ca948171fe HAL_ChibiOS: fixed ADC error on revXY STM32H7 boards
with the new ChibiOS revision we were configuring for newer revisions
of the H7, which meant that we changed the ADC config. This broke ADC
readings on revX and revY H7 MCUs.

This PR fixes it in two ways:

 1) change ChibiOS config to assume XY config chips

 2) use 16 bit ADC for H7, which means the chip rev doesn't matter,
    and also gives us 16x the resolution for ADC readinga, so we can
    read smaller voltage and current values
2021-04-05 11:01:03 +10:00
Andrew Tridgell 2d4dfe8a2a HAL_ChibiOS: fixed (unused) FF_FS_TIMEOUT
this change was harmless as we don't define FF_FS_REENTRANT
2021-03-23 12:01:20 +11:00
Andrew Tridgell ffb2876f58 HAL_ChibiOS: disable unused ChibiOS features 2021-03-23 12:01:20 +11:00
Andrew Tridgell 439a944801 HAL_ChibiOS: added support for STM32G474 MCU 2021-03-23 12:01:20 +11:00
Andy Piper e1d71486e4 AP_HAL_ChibiOS: build fixes for ChibiOS 20.3.x 2021-03-23 12:01:20 +11:00
Andrew Tridgell 5b59445471 AP_HAL_ChibiOS: fixes for build with 20.3.x ChibiOS 2021-03-23 12:01:20 +11:00
Andrew Tridgell 243cf2199d HAL_ChibiOS: disable shared DMA on IOMCU
this saves about 600 bytes of ram
2021-02-24 18:21:08 +11:00
Andrew Tridgell 7af20e9ea3 HAL_ChibiOS: increase H7 serial buffer sizes
this takes better advantage of the new UART code. Log download over
USB gets to 730 kbyte/s. For comparison, with the 4.0 code on the same
H7 we get about 300 kbyte/s
2021-02-20 20:49:45 +11:00
Andrew Tridgell 5e0f175223 HAL_ChibiOS: adjust UART buffer sizes for new UART code
this gains about 20k of RAM, and has almost no impact on log download
speed at 921600 on a F427. The improved threading means we can afford
to have smaller buffers
2021-02-20 14:37:11 +11:00
Andy Piper f9c5f9be00 AP_HAL_ChibiOS: make dshot DMA unlock event driven in order to allow unlocking from rcout thread
refactor rcout into separate thread and process all dshot requests there
move uart DMA completion to event model
process dshot locks in strick reverse order when unlocking
convert Shared_DMA to use mutexes
move UART transmit to a thread-per-uart
do blocking UART DMA transactions
do blocking dshot DMA transactions
trim stack sizes
cancel dma transactions on dshot when timeout occurs
support contention stats on blocking locking
move thread supression into chibios_hwdef.py
invalidate DMA bounce buffer correctly
separate UART initialisation into two halves
cleanup UART transaction timeouts
add @SYS/uarts.txt
move half-duplex handling to TX thread
correct thread statistics after use of ExpandingString
set unbuffered TX thread priority owner + 1
correctly unlock serial_led_send()
don't share IMU RX on KakuteF7Mini
observe dshot pulse time more accurately.
set TRBUFF bit for UART DMA transfers
deal with UART DMA timeouts correctly
don't deadlock on reverse ordered DMA locks
change PORT_INT_REQUIRED_STACK to 128
2021-02-20 14:37:11 +11:00
Andy Piper 2cdc202d19 AP_HAL_ChibiOS: use non-cachable SRAM3 for DMA on H743
Adjust SRAM1+SRAM2 to 256k as describe in the H743 reference manual
Provide access to mem_info() information

Co-authored-by: Andrew Tridgell <andrew@tridgell.net>
2021-02-03 23:35:44 +11:00
Andy Piper 6f5d5c2bf9 AAP_HAL_ChibiOS: allow asserts to be printed on a GPIO pin 2021-01-27 19:36:58 +11:00
Andy Piper 2823fa7245 AP_HAL_ChibiOS: never write bytes that have not been erased on H7
Be more careful about flash failure conditions on H7
2021-01-27 18:30:36 +11:00
Andy Piper 78735a946e AP_HAL_ChibiOS: allow STM32_FLASH_DISABLE_ISR for H7 2021-01-27 18:30:36 +11:00
bugobliterator 8b90eb23e0 AP_HAL_ChibiOS: distcc doesn't like lst generation commands 2021-01-20 19:21:14 +11:00
pkocmoud 7b61a4d8c2 HAL_ChibiOS: support F7 with no crystal 2021-01-15 15:48:01 +11:00
Andy Piper 83c8807b39 AP_HAL_ChibiOS: when HAL_ENABLE_THREAD_STATISTICS is defined add ChibiOS thread stats to threads.txt
define HAL_ENABLE_THREAD_STATISTICS in hwdef.h
2020-12-30 18:15:05 +11:00
Andrew Tridgell b4201436dd HAL_ChibiOS: fixed flash space on 16k bl boards
this avoids the stm32_flash_recent_erase() function which added around
800 bytes to the bootloader. It is not needed
2020-12-17 12:51:25 +11:00
Andrew Tridgell 0c440d5675 HAL_ChibiOS: cope with flash erase in expected delay
when there has been a flash erase when we are definately in an
expected delay
2020-12-08 13:22:36 +11:00
Andrew Tridgell ba69cd72c9 HAL_ChibiOS: improved stack checking and stack display
display both ISR stack and thread stacks. Show total stack sizes as
well as amount of stack remaining
2020-12-01 11:14:50 +11:00
Andrew Tridgell 84eac7642b HAL_ChibiOS: improved stack checking 2020-12-01 11:14:50 +11:00
Andrew Tridgell 2a29b0fcf5 HAL_ChibiOS: fixed AP_Periph build with --enable-asserts 2020-12-01 11:14:50 +11:00
Andrew Tridgell 408f8b3940 HAL_ChibiOS: added check for overwrite of nullptr on H7
the STM32H7 has 64k of ITCM memory at address zero. We allow
allocation of everything except the first 1024 bytes. This checks for
those reserved bytes being overwritte, which would indicate a write to
nullptr
2020-11-18 17:14:43 +11:00
Andrew Tridgell 95a823a702 HAL_ChibiOS: added link list of all memory allocations
check all allocations for corruption on free() and malloc_check()
2020-11-18 17:14:43 +11:00
Andrew Tridgell ce3e1a69ec HAL_ChibiOS: added memory guard system 2020-11-18 17:14:43 +11:00
Andrew Tridgell 84bd59a7bb HAL_ChibiOS: support H7 with no crystal 2020-07-10 13:33:51 +10:00
Andrew Tridgell cfbfb27004 HAL_ChibiOS: support no-crystal F3 setups 2020-07-10 13:33:51 +10:00
Andrew Tridgell 6a1f43d5df HAL_ChibiOS: fixed build with our old compiler
gcc 4.9 doesn't like static_assert() in C code
2020-06-07 14:11:48 +10:00
Andrew Tridgell 69676cd614 HAL_ChibiOS: support 24MHz f3 MCUs 2020-05-10 15:09:28 +10:00
Andrew Tridgell 3ec2ef787d HAL_ChibiOS: fixed build warning 2020-04-29 12:20:19 +10:00
Andrew Tridgell ce68e0fbb5 HAL_ChibiOS: fixed bootloader build 2020-04-29 07:36:55 +10:00
Andrew Tridgell 18e88e0ea3 HAL_ChibiOS: implement stack overflow hook
this needs C bindings to allow call from low level RTOS thread
switching code
2020-04-29 07:36:55 +10:00
Andrew Tridgell f0c9f4003e HAL_ChibiOS: implement thread_info() 2020-04-29 07:36:55 +10:00
Andrew Tridgell d9efac2993 HAL_ChibiOS: only allow PLL override in clock selection part of header 2020-04-28 10:32:23 +10:00
Andrew Tridgell 29f538dec9 HAL_ChibiOS: use common header for STM32 clock config
avoid the need for clock config lines in most hwdef.dat files
2020-04-28 10:32:23 +10:00
Ivannikov Kirill 3ab1b29397 AP_HAL_ChibiOS: error if system clock not 1mhz on 16 CH_CFG_ST_RESOLUTION. prevent variable overflow
if CH_CFG_ST_FREQUENCY not match 1000000U on 16 bit CH_CFG_ST_RESOLUTION
we try to multiply now *= 1000000U/CH_CFG_ST_FREQUENCY; it may overflow 16 bit value.
2020-04-26 19:58:54 +10:00
Andrew Tridgell db642717be HAL_ChibiOS: fixed clock for FDCAN to be below 80MHz
we were running at 100MHz, which is out of spec
2020-04-24 16:55:03 +10:00
Andrew Tridgell 8e977183fe HAL_ChibiOS: added mRoNexus 2020-04-23 07:28:13 +10:00
Andrew Tridgell 74f33d57c5 HAL_ChibiOS: avoid unnecessary H7 flash writes 2020-04-14 10:02:51 +10:00
Andrew Tridgell 822460ce7d HAL_ChibiOS: fixed strdup() on ChibiOS 2020-03-28 15:28:03 +11:00
bugobliterator 8215537f99 HAL_ChibiOS: deprecate realloc for ChibiOS build, so as to return error when used 2020-03-24 10:32:14 +11:00
Peter Barker 1a123e5f8d AP_HAL_ChibiOS: avoid referencing flash sector/page 22 on 1MB boards 2020-03-03 10:13:53 +11:00
Andrew Tridgell 9e0edba31d HAL_ChibiOS: raised timer clocks to 200MHz
this gives more flexibility in setting up timers for DShot
2020-02-12 18:12:39 +11:00
Andrew Tridgell 982cff0695 AP_HAL_ChibiOS: make all semaphores recursive
the cost is very similar and this prevents an easy coding error which
can occur on less used code paths
2020-01-19 20:19:30 +11:00
Andrew Tridgell 2b7bffa906 HAL_ChibiOS: adjust dma reserve allocation
use larger target and allow for smaller allocation
2020-01-18 07:13:11 +11:00
Andrew Tridgell 56985f8c33 HAL_ChibiOS: added checking on bouncebuffer allocation
fail operations if DMA bouncebuffer alloc fails
2020-01-18 07:13:11 +11:00
Andrew Tridgell fced7d78fc HAL_ChibiOS: fixed clock src for I2C4 on H7 2020-01-08 05:56:23 +11:00
Andrew Tridgell 8ffd1050eb HAL_ChibiOS: fixed build on STM32F3 2020-01-02 09:52:57 +11:00