From 5b84eaaf946e8f53ba55c810126ca7c348a565fe Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 10 Jan 2021 12:30:10 -0500 Subject: [PATCH] Migrate to newer ChibiOS #710 --- firmware/docs/chibios_rusefi_20.patch | 121 ++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 9 deletions(-) diff --git a/firmware/docs/chibios_rusefi_20.patch b/firmware/docs/chibios_rusefi_20.patch index 7fdb81d875..57f735b3b8 100644 --- a/firmware/docs/chibios_rusefi_20.patch +++ b/firmware/docs/chibios_rusefi_20.patch @@ -1,9 +1,9 @@ diff -uwr Chibios.20_original/.git/FETCH_HEAD Chibios.20_rusefi/.git/FETCH_HEAD ---- Chibios.20_original/.git/FETCH_HEAD 2021-01-09 18:09:26.371949000 -0500 -+++ Chibios.20_rusefi/.git/FETCH_HEAD 2021-01-09 18:09:27.021382000 -0500 +--- Chibios.20_original/.git/FETCH_HEAD 2021-01-10 12:25:35.549331500 -0500 ++++ Chibios.20_rusefi/.git/FETCH_HEAD 2021-01-10 12:25:36.370659800 -0500 @@ -1,4 +1,4 @@ -d96c2af163e53c456bdd885c52056d20545b6dde branch 'stable_20.3.x' of https://github.com/rusefi/ChibiOS -+df4bd5b74baae726ae7c47948dacd557a3430a2d branch 'stable_20.3.x.rusefi' of https://github.com/rusefi/ChibiOS ++0b4897475aceea4ae791f104297d334911a5adf7 branch 'stable_20.3.x.rusefi' of https://github.com/rusefi/ChibiOS bbb700257e3e932f60e12e8a2c7dc2120cea3e26 not-for-merge branch 'master' of https://github.com/rusefi/ChibiOS a4b2c113e74e026dfc7cc02060b32ab3f047ae8d not-for-merge branch 'revert-10-master' of https://github.com/rusefi/ChibiOS e61ff3aa1c1fd0f1057e08ae4551abbc01595550 not-for-merge branch 'stable_1.0.x' of https://github.com/rusefi/ChibiOS @@ -11,7 +11,7 @@ diff -uwr Chibios.20_original/.git/FETCH_HEAD Chibios.20_rusefi/.git/FETCH_HEAD c807840cdcec4e09b3fd0d2268370d9a317f0b90 not-for-merge branch 'stable_2.2.x' of https://github.com/rusefi/ChibiOS 062803674562e117754c051992535d69a3762573 not-for-merge branch 'stable_2.4.x' of https://github.com/rusefi/ChibiOS 0b0e793cc832373af431029878bc4b6f8c3e5fa5 not-for-merge branch 'stable_2.6.x' of https://github.com/rusefi/ChibiOS --df4bd5b74baae726ae7c47948dacd557a3430a2d not-for-merge branch 'stable_20.3.x.rusefi' of https://github.com/rusefi/ChibiOS +-0b4897475aceea4ae791f104297d334911a5adf7 not-for-merge branch 'stable_20.3.x.rusefi' of https://github.com/rusefi/ChibiOS +d96c2af163e53c456bdd885c52056d20545b6dde not-for-merge branch 'stable_20.3.x' of https://github.com/rusefi/ChibiOS 7596c99a218929e8c93341e2afa353134b64e233 not-for-merge branch 'stable_3.0.x' of https://github.com/rusefi/ChibiOS 93fdc45672692a73b3734b0e77f5978944477a2b not-for-merge branch 'stable_rusefi' of https://github.com/rusefi/ChibiOS @@ -22,6 +22,12 @@ diff -uwr Chibios.20_original/.git/HEAD Chibios.20_rusefi/.git/HEAD @@ -1 +1 @@ -ref: refs/heads/stable_20.3.x +ref: refs/heads/stable_20.3.x.rusefi +diff -uwr Chibios.20_original/.git/ORIG_HEAD Chibios.20_rusefi/.git/ORIG_HEAD +--- Chibios.20_original/.git/ORIG_HEAD 2021-01-10 12:25:35.585422000 -0500 ++++ Chibios.20_rusefi/.git/ORIG_HEAD 2021-01-10 12:25:36.407332200 -0500 +@@ -1 +1 @@ +-d96c2af163e53c456bdd885c52056d20545b6dde ++df4bd5b74baae726ae7c47948dacd557a3430a2d diff -uwr Chibios.20_original/.git/config Chibios.20_rusefi/.git/config --- Chibios.20_original/.git/config 2021-01-09 18:01:23.044248500 -0500 +++ Chibios.20_rusefi/.git/config 2021-01-09 17:58:02.264312400 -0500 @@ -37,11 +43,12 @@ diff -uwr Chibios.20_original/.git/config Chibios.20_rusefi/.git/config Binary files Chibios.20_original/.git/index and Chibios.20_rusefi/.git/index differ diff -uwr Chibios.20_original/.git/logs/HEAD Chibios.20_rusefi/.git/logs/HEAD --- Chibios.20_original/.git/logs/HEAD 2021-01-09 18:01:23.042248300 -0500 -+++ Chibios.20_rusefi/.git/logs/HEAD 2021-01-09 18:09:27.085416800 -0500 -@@ -1 +1,2 @@ ++++ Chibios.20_rusefi/.git/logs/HEAD 2021-01-10 12:25:36.444333900 -0500 +@@ -1 +1,3 @@ -0000000000000000000000000000000000000000 d96c2af163e53c456bdd885c52056d20545b6dde rusefillc 1610233283 -0500 clone: from https://github.com/rusefi/ChibiOS +0000000000000000000000000000000000000000 d96c2af163e53c456bdd885c52056d20545b6dde rusefillc 1610233082 -0500 clone: from https://github.com/rusefi/ChibiOS +d96c2af163e53c456bdd885c52056d20545b6dde df4bd5b74baae726ae7c47948dacd557a3430a2d rusefillc 1610233767 -0500 pull: Fast-forward ++df4bd5b74baae726ae7c47948dacd557a3430a2d 0b4897475aceea4ae791f104297d334911a5adf7 rusefillc 1610299536 -0500 pull: Fast-forward Only in Chibios.20_original/.git/logs/refs/heads: stable_20.3.x Only in Chibios.20_rusefi/.git/logs/refs/heads: stable_20.3.x.rusefi diff -uwr Chibios.20_original/.git/logs/refs/remotes/origin/HEAD Chibios.20_rusefi/.git/logs/refs/remotes/origin/HEAD @@ -52,11 +59,13 @@ diff -uwr Chibios.20_original/.git/logs/refs/remotes/origin/HEAD Chibios.20_ruse +0000000000000000000000000000000000000000 bbb700257e3e932f60e12e8a2c7dc2120cea3e26 rusefillc 1610233082 -0500 clone: from https://github.com/rusefi/ChibiOS Only in Chibios.20_rusefi/.git/logs/refs/remotes/origin: stable_20.3.x diff -uwr Chibios.20_original/.git/logs/refs/remotes/origin/stable_20.3.x.rusefi Chibios.20_rusefi/.git/logs/refs/remotes/origin/stable_20.3.x.rusefi ---- Chibios.20_original/.git/logs/refs/remotes/origin/stable_20.3.x.rusefi 2021-01-09 18:09:26.371949000 -0500 -+++ Chibios.20_rusefi/.git/logs/refs/remotes/origin/stable_20.3.x.rusefi 2021-01-09 18:09:27.020421400 -0500 -@@ -1 +1 @@ +--- Chibios.20_original/.git/logs/refs/remotes/origin/stable_20.3.x.rusefi 2021-01-10 12:25:35.548331700 -0500 ++++ Chibios.20_rusefi/.git/logs/refs/remotes/origin/stable_20.3.x.rusefi 2021-01-10 12:25:36.369659600 -0500 +@@ -1,2 +1,2 @@ -d96c2af163e53c456bdd885c52056d20545b6dde df4bd5b74baae726ae7c47948dacd557a3430a2d rusefillc 1610233766 -0500 pull: fast-forward +-df4bd5b74baae726ae7c47948dacd557a3430a2d 0b4897475aceea4ae791f104297d334911a5adf7 rusefillc 1610299535 -0500 pull: fast-forward +d96c2af163e53c456bdd885c52056d20545b6dde df4bd5b74baae726ae7c47948dacd557a3430a2d rusefillc 1610233767 -0500 pull: fast-forward ++df4bd5b74baae726ae7c47948dacd557a3430a2d 0b4897475aceea4ae791f104297d334911a5adf7 rusefillc 1610299536 -0500 pull: fast-forward Only in Chibios.20_original/.git/objects/pack: pack-668cff25d611c7199e7543d5cdd7c5662f4aa17b.idx Only in Chibios.20_original/.git/objects/pack: pack-668cff25d611c7199e7543d5cdd7c5662f4aa17b.pack Only in Chibios.20_rusefi/.git/objects/pack: pack-bbcef4de2c0001c4f9864417bebcfd4e562d8838.idx @@ -195,6 +204,100 @@ diff -uwr Chibios.20_original/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h Chib } UARTConfig; /** +diff -uwr Chibios.20_original/os/hal/src/hal_mmc_spi.c Chibios.20_rusefi/os/hal/src/hal_mmc_spi.c +--- Chibios.20_original/os/hal/src/hal_mmc_spi.c 2021-01-09 18:01:25.109427500 -0500 ++++ Chibios.20_rusefi/os/hal/src/hal_mmc_spi.c 2021-01-10 12:25:36.436332200 -0500 +@@ -31,6 +31,8 @@ + + #if (HAL_USE_MMC_SPI == TRUE) || defined(__DOXYGEN__) + ++#define MMC_WAIT_RETRY 3000 ++ + /*===========================================================================*/ + /* Driver local definitions. */ + /*===========================================================================*/ +@@ -172,6 +174,10 @@ + return; + } + } ++#if MMC_NICE_WAITING == TRUE ++ int waitCounter = 0; ++#endif ++ + /* Looks like it is a long wait.*/ + while (true) { + spiReceive(mmcp->config->spip, 1, buf); +@@ -181,6 +187,10 @@ + #if MMC_NICE_WAITING == TRUE + /* Trying to be nice with the other threads.*/ + osalThreadSleepMilliseconds(1); ++ if (++waitCounter == MMC_WAIT_RETRY) { ++ // it's time to give up, this MMC card is not working property ++ break; ++ } + #endif + } + } +@@ -356,6 +366,9 @@ + uint8_t buf[1]; + + spiSelect(mmcp->config->spip); ++#if MMC_NICE_WAITING == TRUE ++ int waitCounter = 0; ++#endif + while (true) { + spiReceive(mmcp->config->spip, 1, buf); + if (buf[0] == 0xFFU) { +@@ -364,6 +377,10 @@ + #if MMC_NICE_WAITING == TRUE + /* Trying to be nice with the other threads.*/ + osalThreadSleepMilliseconds(1); ++ if (++waitCounter == MMC_WAIT_RETRY) { ++ // it's time to give up, this MMC card is not working property ++ break; ++ } + #endif + } + spiUnselect(mmcp->config->spip); +diff -uwr Chibios.20_original/os/rt/include/chdebug.h Chibios.20_rusefi/os/rt/include/chdebug.h +--- Chibios.20_original/os/rt/include/chdebug.h 2021-01-09 18:01:25.165428500 -0500 ++++ Chibios.20_rusefi/os/rt/include/chdebug.h 2021-01-10 12:25:36.437332000 -0500 +@@ -61,8 +61,8 @@ + /*===========================================================================*/ + + #if CH_DBG_SYSTEM_STATE_CHECK == TRUE +-#define _dbg_enter_lock() (ch.dbg.lock_cnt = (cnt_t)1) +-#define _dbg_leave_lock() (ch.dbg.lock_cnt = (cnt_t)0) ++#define _dbg_enter_lock() do {ch.dbg.lock_cnt = (cnt_t)1; ON_LOCK_HOOK;} while(0) ++#define _dbg_leave_lock() do {ON_UNLOCK_HOOK; ch.dbg.lock_cnt = (cnt_t)0;} while(0) + #endif + + /* When the state checker feature is disabled then the following functions +diff -uwr Chibios.20_original/os/various/cpp_wrappers/syscalls_cpp.cpp Chibios.20_rusefi/os/various/cpp_wrappers/syscalls_cpp.cpp +--- Chibios.20_original/os/various/cpp_wrappers/syscalls_cpp.cpp 2021-01-09 18:01:25.192427800 -0500 ++++ Chibios.20_rusefi/os/various/cpp_wrappers/syscalls_cpp.cpp 2021-01-10 12:25:36.437332000 -0500 +@@ -19,8 +19,8 @@ + return 1; + } + +-#undef errno +-extern int errno; ++//#undef errno ++//extern int errno; + int _kill(int pid, int sig) { + (void)pid; + (void)sig; +diff -uwr Chibios.20_original/os/various/cpp_wrappers/syscalls_cpp.hpp Chibios.20_rusefi/os/various/cpp_wrappers/syscalls_cpp.hpp +--- Chibios.20_original/os/various/cpp_wrappers/syscalls_cpp.hpp 2021-01-09 18:01:25.192427800 -0500 ++++ Chibios.20_rusefi/os/various/cpp_wrappers/syscalls_cpp.hpp 2021-01-10 12:25:36.438332400 -0500 +@@ -8,6 +8,6 @@ + void __cxa_guard_release (__guard *); + void __cxa_guard_abort (__guard *); + +-void *__dso_handle = NULL; ++//void *__dso_handle = NULL; + + #endif /* SYSCALLS_CPP_HPP_ */ diff -uwr Chibios.20_original/os/various/syscalls.c Chibios.20_rusefi/os/various/syscalls.c --- Chibios.20_original/os/various/syscalls.c 2021-01-09 18:01:25.272773700 -0500 +++ Chibios.20_rusefi/os/various/syscalls.c 2021-01-09 18:09:27.079382600 -0500