Commit Graph

279 Commits

Author SHA1 Message Date
Andrey 25b6d39802 os_access.h dead? 2022-09-07 15:56:45 -04:00
Andrey G 074563ddfd OpenBLT shared params (#4417)
* OpenBLT: linker file: use last 16 bytes of ram for shared area

This area is used for communication between FW and OpenBLT.

* OpenBLT: startup: invalidate only DFU breadcumb from startup code

Same location (but different seed) is used for shared param's
signature in OpenBLT.

* OpenBLT: enable shared params

* OpenBLT: enable hooks

If 0x01 is stored in shared param idx=0, then stay in OpenBLT forever.

* Jump to OpenBLT: store proper shared param when OpenBLT is requested

TODO: calculate and store CRC too!

* OpenBLT: move shared_params to start of RAM

* Bootloader: Allocate 16 bytes at start of RAM for bootloader shared area

* OpenBLT: shared_params: reuse same .c and .h file for main application

* OpenBLT: shared_params: enable CRC check

* OpenBLT: no need to manualy set breadcumb before reset

* Revert "OpenBLT: startup: invalidate only DFU breadcumb from startup code"

This reverts commit 6b064714b953560227ae53e38355332cf9f46f7f.

* OpenBLT: guard for builds without OpenBLT

* OpenBLT: reboot to OpenBLT on CAN request with ID=0x667 and DLC=2

* config: options to enable OpenBLT on CAN interfaces

* OpenBLT: comments
2022-08-07 19:33:19 -04:00
rusefillc b3e13f12b4 Adc mux (#4379)
* adc mux

* cypress is a special ADC size case

Co-authored-by: Matthew Kennedy <matthewkennedy@outlook.com>
Co-authored-by: rusefillc <sdfsdfqsf2334234234>
2022-07-26 14:12:00 +03:00
Andrey G bdaf1587d7 Openblt to dfu jump fixed (#4367)
* OpenBLT: supress "target 'startup_xxxxxx.o' given more than once in the same rule" warning

* OpenBLT: check for DFU request, do not ignore dead beef
2022-07-22 07:43:15 -04:00
Andrey G 4a4443a27d Add "Reset to OpenBLT" button (#4364)
Similar to "Reset to DFU", but uses different seed
2022-07-22 08:21:11 +03:00
rusefillc 5aa9942fe0 more on MRE BT drama part 2 2022-07-18 02:15:31 -04:00
rusefillc 02ce0423bf STM32_HSE_BYPASS where we need it (#4338)
Co-authored-by: rusefillc <sdfsdfqsf2334234234>
2022-07-11 04:30:49 -04:00
Matthew Kennedy 16a39badff Error handling cleanup (#4332)
* dead code in stm32

* rusefi.cpp can have some noreturn

* handle lua panic

* unused error codes

* simplifications of error_handling.cpp

* comment

* put that back

* guard
2022-07-07 23:49:02 -04:00
Matthew Kennedy 6267b8621a big delete ICU (#4270)
* big delete

* icu vestiges

* changelog
2022-07-07 15:27:59 -04:00
Matthew Kennedy cbdfb7ac5c Write hard faults to backup ram, print on next boot (#4324)
* use backup ram, hard fault handler improvement

* wire it up

* upload elf

* s

* I guess I'll just use strncpy

* s

* what is it even complaining about?

* neat, we don't need a cast

* cypress and kinetis

* cleanup

* ci

* guard for tests
2022-07-07 15:14:31 -04:00
rusefillc 33ba12f130 docs 2022-06-07 17:13:21 -04:00
rusefillc b1927528e7 Matt drives H7 #4175 2022-05-24 18:28:16 -04:00
rusefillc e3d5e9ce0f reducing code duplication, also one step back with HSE 2022-05-24 16:25:16 -04:00
rusefillc 9cae07cfd2 reducing code duplication 2022-05-24 15:45:06 -04:00
rusefillc 66bdc45ed6 typos 2022-05-24 15:07:31 -04:00
Matthew Kennedy 6813ff141f correct channels (#4190) 2022-05-19 19:09:41 -04:00
Matthew Kennedy 4531ef2286 harley (#4188) 2022-05-19 16:44:56 -04:00
rusefillc 54dcb27346 spelling 2022-05-02 16:08:04 -04:00
Matthew Kennedy 83caf1ea1b Brain pin is enum class (#4108)
* change most usages to Gpio::

* board configs

* engine configs etc

* isBrainPinValid, smart gpio

* generator

* generator

* generator

* connector yamls

* kinetis enums

* cypress txt

* kinetis config

* frankenso

* config generator

* actually do it for the others

* disable skips for pr ci

* fix tle8888

* misc

* weird cast from int

* needs this operator too

* this can be an unsigned subtract

* happy tests

* s

* kinetis isConfigurationChanged weirdness

* missed J/K

* cypress efifeatures

* build script mistake (!)

* mistake in smart gpio

* debounce

* eg33

* kinetis, so needy

* it's pretty green, we can skip these again
2022-04-28 17:32:39 -04:00
Matthew Kennedy a2e1a079b8 allow enum_class in rusefi_hw_enums.h (#4104)
* make things c++ friendly

* install various canaries in coal mines

* using is much clearer than typedef

* fixing builds

* lps25

* trigger includes were a mess

* c -> c++ cleanup

* os util

* why did so many include os_util.h?

* fwd declare

* cypress/kinetis

* s

* eg33 happy

* happy sim

* cypress usb

* pch

* cypress

* doesn't need to include all that

* h7
2022-04-25 20:38:16 -04:00
rusefillc 0a0345b754 We have working runtime RAM detection - we shall use it for Lua #3970 2022-03-27 19:39:40 -04:00
rusefi 63f430d5d6 typo & progress 2022-03-15 15:50:39 -04:00
rusefillc e6875c4f3f https://github.com/rusefi/rusefi/pull/3976
maybe probably help
2022-03-02 18:52:00 -05:00
Andrey G df1c6a4b7c ports: stm32f7: ld file: fix typo (#3956) 2022-02-23 10:03:44 -05:00
Andrey G 311542e84a Flash size on eg33 (#3955)
* subaru-eg33: 1M of flash is available for FW and bootloader

* ports: stm32f7: allow board define its flash size, otherwise 512K
2022-02-23 07:36:58 -05:00
Matthew Kennedy 6e4cb12275 mitigate F7 flash error by making the image smaller (#3859)
* grumble

* do it for all F7
2022-02-19 15:56:44 -05:00
Andrey G 785c9792c3 usb descriptor: we are bus powered and can consume up to 400mA (#3933) 2022-02-13 16:12:22 -05:00
rusefi cdbd94a15b I2C EEPROM support #3860 2022-02-06 17:23:07 -05:00
Matthew Kennedy 8f536425fb fix f4 standby (#3894)
* fix the bug

* wake on PD0 = CAN RX

* cleanup
2022-02-05 07:25:09 -05:00
rusefillc 6eefbca135 I2C EEPROM support #3860
let's go with EE24 for now
2022-02-04 22:03:12 -05:00
rusefillc b1a7797c09 Wider usage of contrib (#3892)
* I2C EEPROM support #3860

let's use contrib on all F4

* I2C EEPROM support #3860

let's use contrib on all F4, step 2

* I2C EEPROM support #3860

let's use contrib on all F4, step 3

* I2C EEPROM support #3860

let's use contrib on all F4, step 4

* I2C EEPROM support #3860

huh

* I2C EEPROM support #3860

all the way

Co-authored-by: rusefillc <sdfsdfqsf2334234234>
2022-02-04 21:50:21 -05:00
rusefillc 606476fc57 Revert "I2C EEPROM support #3860"
This reverts commit 22a6d5b0f3.
2022-01-31 20:39:20 -05:00
rusefillc 22a6d5b0f3 I2C EEPROM support #3860 2022-01-31 19:48:53 -05:00
rusefillc 6836c80cd0 I2C EEPROM support #3860 2022-01-31 18:58:39 -05:00
rusefillc 321d032f50 docs 2022-01-26 13:13:06 -05:00
rusefillc 324b90e6e7 https://github.com/rusefi/alphax-2chan/issues/22 2022-01-22 17:28:11 -05:00
rusefillc 93fff340fd https://github.com/rusefi/alphax-2chan/issues/22 2022-01-22 16:50:58 -05:00
NMSTEC 6cdb5514a5 Add comments to Stop & Stby modes (#3798) 2022-01-17 13:11:24 -05:00
rusefillc 97b194f753 PA0 wake up - sharing is caring? 2022-01-17 01:25:31 -05:00
rusefillc 9ec0393d9e Catch up with Chibios 20.3 #2555 2022-01-15 21:43:01 -05:00
NMSTEC 190c895e05 F429 Working Stby, Stop & Wake PA0 (#3787) 2022-01-12 23:18:58 -05:00
rusefillc fc996ad339 Code style for methods with zero arguments #3535 2022-01-11 22:26:24 -05:00
Andrey G fc32af43bb F429 discovery ram dev (#3761)
* stm32f429-discovery: mostly copy-paste from ChibiOS-Contrib

* STM32F429-discovery has external SDRAM

* F429-Discovery: add simple memory test for SDRAM (disabled)

* Revert "random piece of https://github.com/dron0gus/rusefi/tree/f429-discovery-ram-dev"

This reverts commit 9625820272.

Co-authored-by: rusefillc <sdfsdfqsf2334234234>
2022-01-10 16:14:39 -05:00
Matthew Kennedy 4ee76aadc2 per-board pre-low-power handlers (#3752)
* per-board pre-low-power handlers

* per-chip standby options

* default implementation
2022-01-10 08:37:05 -05:00
Andrey G 8205c37da0 Sdram preparations (#3764)
* ports: stm32f4: not all stm32f4xx are stm32f407, let board decide

* Do not include mcuconf_community.h in port's mcuconf.h usign relative path

as override file can be provided in board directory.
2022-01-10 08:31:29 -05:00
rusefillc 9625820272 random piece of https://github.com/dron0gus/rusefi/tree/f429-discovery-ram-dev 2022-01-09 22:45:46 -05:00
Andrey G b37c9d546f Enable ENABLE_AUTO_DETECT_HSE only if STM32_HSECLK is not defined (#3758)
Some board (like stm32f429-disco) with SDRAM need clock to be
enabled in __early_init (before .bss and .data initialization).
So if STM32_HSECLK defined - skip clock detection.
2022-01-09 17:39:29 -05:00
Andrey G 26a9795d94 Ports: STM32F4: add optional external SDRAM (#3762) 2022-01-09 17:39:10 -05:00
Andrey G f139e76345 USB: use OTG1/OTG2 for serial over USB depending on which enabled (#3757) 2022-01-08 16:33:48 -05:00
Andrey G f4730421ed mk files random cleanup (#3759) 2022-01-08 16:33:34 -05:00
NMSTEC 1bde061b2d Stop & wakeup working on rising edge (#3747)
* Stop & wakeup working on rising edge

* Standby & Sleep mode working Using PA0 only.

* Stop & standby works with wake from PA0.
Added alternative interrupt method to STOP

* Removed hand screwery on registers
2022-01-07 16:46:28 -05:00
Matthew Kennedy a6ef26a1d5 fix dual CAN init, update UI (#3719)
* CAN init sequence

* config & UI cleanup

* ui

* simplify
2021-12-24 23:33:54 -05:00
rusefillc 604f84fe9f Second CAN #3687 2021-12-22 20:43:08 -05:00
rusefillc 8f51dad2ef Second CAN #3687 2021-12-22 20:39:07 -05:00
rusefillc 319ee90b46 Second CAN #3687 2021-12-22 20:15:22 -05:00
rusefillc 6f0e0a33f2 Second CAN #3687 2021-12-22 20:15:22 -05:00
Matthew Kennedy 0d1539f869 multi CAN plumbing (#3688)
* framing for multi CAN

* typoooooooo
2021-12-10 17:08:10 -05:00
Matthew Kennedy da28561241 testing stm32 stop/standby (#3666)
* testing stop/standby

* comments

* guard

* s

* we shall figure out f7 later

* ok maybe we do worry about f7

* comments and tweaks

* f7

* f4 maybe probably
2021-12-07 15:12:33 -05:00
Scott Smith 8406fafa9e Expose console over serial port for H7 proc (#3578)
This way you can use the console/TunerStudio with the ST-Link

In the process, combine TS_PRIMARY_UART and TS_PRIMARY_SERIAL into TS_PRIMARY_PORT, to make UART vs
SERIAL selection more robus.  Ditto for TS_SECONDARY_*.  Also change use of TS_NO_PRIMARY to be #if
not #ifdef, so that it can be properly set as a compile flag and not be overwritten by various
header files.
2021-11-20 00:39:08 -05:00
Matthew Kennedy 739be57ac8 fast exti interrupt handoff (#3497)
* fast exti

* test code snuck in

* full interrupt disable :(

* do it the old fashioned way

* enable interrupt

* consume stored timestamp

* dead

* h7 maybe

* guard maybe

* non-stm32

* exti 16 wrong on f4/f7

* CORTEX_MAXIMUM_PRIORITY

* safer but uglier

* s

* chibios

* no const

* initializers

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-11-19 06:37:52 -05:00
Scott Smith 80091498a6 Programmatically replace ENGINE() and CONFIG() with engine-> etc (#3565)
git grep -l -w ENGINE | xargs sed -i -r "s/ENGINE\(([]a-zA-Z_0-9.[]+)\)/engine->\1/g"

git grep -l -w CONFIG | xargs sed -i -r "s/([^a-zA-Z_])CONFIG\(([]a-zA-Z_0-9.[]+)\)/\1engineConfiguration->\2/g"
2021-11-17 03:54:21 -05:00
Matthew Kennedy c1941f3a49 (void) -> () (#3550)
* static functions with (void)

* more

* Revert "more"

This reverts commit 246e53441f935451437df186ac92d7df26b62fb6.

* s

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-11-15 13:02:34 +01:00
Andrey G 51f53aa3fc Openblt (#3430)
* Makefile: define BOOTLOADER=1 for linker in case of OpenBLT too

This will reserve first 32K of flash for bootloader.

* OpenBLT: include into build

* board: subaru eg33: add OpenBLT board code

* board: subaru eg33: use OpenBLT

* Board: Subaru EG33: OpenBLT: reuse HAL and CMSIS from OpenBLT submodule

* Board: Subaru EG33: OpenBLT: reuse linker file from OpenBLT too

* OpenBLT for MRE

* OpenBLT: MRE: adjust LD memory map for smallest variat of MCU on MRE

* OpenBLT: enable for MRE

* OpenBLT: disable CRC check of user application

This allows us to use DFU tool to flash main application too.

* hex2dfu: fresh binary for linux

* OpenBLT: extract common part of OpenBLT makefiles to openblt.mk

* OpenBLT: enable CRC check of user application for MRE and EG33

CRC (actually just a summ) of few first vectors is stored at 0x1c
offset. This is reserved vector for Cortex-M3, M4 and M7

* common_make: append OpenBLT CRC to dfu files

This should allow to use DFU to do main application update when
when OpenBLT is used as bootloader. hex2dfu will store same
styled CRC as OpenBLT expects to see in user app.

* OpenBLT reorganization

Move common stuff to hw_layer/ports/

* OpenBLT: proteus

* Proteus: enable OpenBLT for F4 and F7

Compilation tested only
2021-11-05 19:28:55 -04:00
Andrey G a7b2a032d2 Linker file typo fix (#3436) 2021-10-31 15:17:56 -04:00
Andrey G be75132ebe STM32F7 linker script: ITCM flash area also needs reserve for BL (#3431) 2021-10-30 09:12:47 -04:00
Matthew Kennedy 6125d97c6c etb pwm limit (#3408)
* etb pwm limit

* missed an arg

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-10-25 15:35:23 -04:00
Matthew Kennedy 8ca619144d misc ethernet config parameters (#3343)
* various cfg

* this has to be 1522

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-10-11 15:35:09 -04:00
Matthew Kennedy 95ef3f30ae faster uniform adc cleanup (#3334)
* dead fast tps

* oooooh map avg on hh7

* adc v4 fast support

* new fast API

* hardware.cpp

* adc v2

* warning

* guard

* no check required

* stub cypress/kinetis

* kinetis and cypress stubs

* cleanup

* h7 adc speed

* adc skip

* configurable oversample
2021-10-10 22:59:25 -04:00
Matthew Kennedy 208497e6ed ethernet (#3342)
* checksum offload

* ethernet console

* guard flag

* flags

* reserve pins

* f4

* ip and link options

* chibios

* conditional build lwip

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-10-10 01:15:49 -04:00
Matthew Kennedy a4998ab7a8 Fast adc API (#3327)
* dead fast tps

* oooooh map avg on hh7

* adc v4 fast support

* new fast API

* hardware.cpp

* adc v2

* warning

* guard

* no check required

* stub cypress/kinetis

* kinetis and cypress stubs
2021-10-07 08:29:01 -04:00
Andrey 8b82023d6b vr threshold test configuration 2021-09-26 03:27:53 -04:00
Matthew Kennedy 29407db1a3 everybody is pulldown (#3131) 2021-08-14 09:34:13 -04:00
rusefillc 49497dec6d Hellen72: Set the default pin states to input-pulldown instead of input-pullup #2525 2021-08-05 04:53:37 -04:00
Matthew Kennedy 39388c75d8 even more pch (#3112)
* s

* more

* s

* f7
2021-08-04 19:30:52 -04:00
Matthew Kennedy 4e6b61234f yet more pch (#3068)
* big pch energy

* put back ramdisk stub

* tests are happy

* h743 nucleo

* kinetis

* I love deleting code!

* make stepper happy

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-08-03 22:05:01 -04:00
Andrey 73cbb388b7 boards file clean-up 2021-08-03 04:06:06 -04:00
Matthew Kennedy 0158327469 s (#3101) 2021-08-02 19:17:17 -04:00
Andrey G 54f0aeb06f Int flash fixes (#3089)
* STM32F7xx: flash write parallelism settings

Datasheed allows 32bit program operation only for 2.7..3.0
While RM defines wider range...

* Add parentheses to defines

* intFlash: show all errors to user

Currently only erase error was exported to user. Flash write error
was silent. Also define few additional error codes and show it to
user.
2021-08-01 18:26:42 -04:00
Andrey G adede96583 Remove outdated option CH_DBG_ENABLE_TRACE (#3087)
Not used since RT5
2021-07-31 07:51:13 -04:00
Matthew Kennedy 58202a97f3 flash erase cache invalidate (#3073)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-07-30 16:52:55 -04:00
Matthew Kennedy d3ec2b21d1 Use pch in lots of files (#3066)
* most engine.h

* most engine_configuration

* more

* more

* more

* more

* more

* moooooore

* ok I'm done for now

* oops
2021-07-26 01:05:17 -04:00
Matthew Kennedy 098469b88c H7 ADC triggered by hardware timer (#3028)
* config

* allow changing adc speed

* timer triggered ADC

* ICU on nucleo

* turn that off too

* 10khz

* make those default for all h7

* I can't type
2021-07-23 14:50:35 -04:00
Matthew Kennedy 2255ce37b4 H7 turn off USB before reset (#2999)
* turn off USB before reset

* comment

* add link
2021-07-20 19:39:26 -04:00
Andrey fb30117acc Button to apply nDBANK #2996
still does not work
2021-07-20 15:42:57 -04:00
Andrey 8eb407627e Button to apply nDBANK #2996
it does not work, i give up for now time to install STM Cube :(
2021-07-20 14:15:58 -04:00
Andrey 668c342b34 Button to apply nDBANK #2996 2021-07-20 13:20:34 -04:00
Matthew Kennedy 7c2f20af49 osc detector on H7 (#2992)
* detect clock with TIM11 instead of TIM5

* s

* h7 has a different register name

* detect on H7

* cleanup

* comment

* use define

* f4 typo
2021-07-19 21:58:23 -04:00
Matthew Kennedy dec215f199 detect clock with TIM11 instead of TIM5 (#2989)
* detect clock with TIM11 instead of TIM5

* s

* h7 has a different register name

* s

* rename
2021-07-19 18:04:59 -04:00
Matthew Kennedy e3849b95d5 don't require EXTERN_ENGINE in every file (#2969)
* move enginePins

* no more extern engine

* uses

* more

* extern config too

* put this where it belongs

* include correct header

* merge
2021-07-16 18:13:33 -04:00
Andrey 3327dc0199 progress 2021-07-15 01:18:38 -04:00
Andrey 1d2fdb0f04 progress 2021-07-15 01:17:42 -04:00
rusefillc 8e8737d6ce trigger signal debug pins - logic level output #2959 2021-07-15 00:03:31 -04:00
Matthew Kennedy c08eb18ca7 Start on HSI clock (#2957)
* chibios uses HSI

* set pll to use HSE

* simplify capture

* even better logging

* string

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-07-14 15:20:38 -04:00
rusefi ad37021a0b printing autoDetectedPllMValue in console 2021-07-14 12:42:35 -04:00
Matthew Kennedy 15931dd56c auto detect HSE clock speed (#2952)
* detect hse

* implementation

* these boards don't need to set their own HSECLK

* assertions

* name

* tweaks

* how did this compile?

* s

* biiiig comment

* this script doesn't need to set 25mhz any more

* ....or PLLM

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-07-12 20:51:35 -04:00
rusefillc b0bfff2c4d typo 2021-07-11 10:16:35 -04:00
Andrey G d508537374 Chibios-Contrib for stm32 (#2903)
* Add Chibios-Contrib for STM32F/H too

* ports: stm32: add community hal and cmu configs for STM32

* ports: stm32: community: disable CRC driver
2021-07-05 09:53:45 -04:00
Matthew Kennedy ca625e7935 non blocking flash on f7 dual bank 2MB (#2749)
* f7 dual bank flash

* only start thread if necessary
2021-05-29 08:05:29 +03:00
Andrey G b4dce2c26d Flash fix erase check (#2750)
* Fix flash erase error formating

* Flash F7: do magic calculation with local copy of sector number

* Falsh stm32: simplify

* typo?
2021-05-28 20:35:54 +03:00
Matthew Kennedy be41a96511 actually fix F7 flash this time (#2719)
* f7 sector sizes

* loop dsb

* correct sector index on f7
2021-05-18 17:40:59 -04:00