rusefillc 2023-06-28 18:29:39 -04:00
parent 515b05d103
commit 875b6c749a
6 changed files with 129 additions and 23 deletions

1
.gitmodules vendored
View File

@ -1,7 +1,6 @@
[submodule "firmware/ChibiOS"]
path = firmware/ChibiOS
url = https://github.com/rusefi/ChibiOS.git
branch = stable_20.3.x.rusefi
[submodule "firmware/ChibiOS-Contrib"]
path = firmware/ChibiOS-Contrib
url = https://github.com/rusefi/ChibiOS-Contrib.git

View File

@ -112,7 +112,7 @@ include $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_P103/board.mk
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
# Auto-build files in ./source recursively.
include $(CHIBIOS)/tools/mk/autobuild.mk
# Other files (optional).

View File

@ -1,5 +1,5 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -29,7 +29,27 @@
#define CHCONF_H
#define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_1_
#define _CHIBIOS_RT_CONF_VER_7_0_
/*===========================================================================*/
/**
* @name System settings
* @{
*/
/*===========================================================================*/
/**
* @brief Handling of instances.
* @note If enabled then threads assigned to various instances can
* interact each other using the same synchronization objects.
* If disabled then each OS instance is a separate world, no
* direct interactions are handled by the OS.
*/
#if !defined(CH_CFG_SMP_MODE)
#define CH_CFG_SMP_MODE FALSE
#endif
/** @} */
/*===========================================================================*/
/**
@ -119,6 +139,19 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/**
* @brief Kernel hardening level.
* @details This option is the level of functional-safety checks enabled
* in the kerkel. The meaning is:
* - 0: No checks, maximum performance.
* - 1: Reasonable checks.
* - 2: All checks.
* .
*/
#if !defined(CH_CFG_HARDENING_LEVEL)
#define CH_CFG_HARDENING_LEVEL 0
#endif
/** @} */
/*===========================================================================*/
@ -160,6 +193,16 @@
#define CH_CFG_USE_TM TRUE
#endif
/**
* @brief Time Stamps APIs.
* @details If enabled then the time stamps APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_TIMESTAMP)
#define CH_CFG_USE_TIMESTAMP TRUE
#endif
/**
* @brief Threads registry APIs.
* @details If enabled then the registry APIs are included in the kernel.
@ -330,6 +373,16 @@
#define CH_CFG_USE_MAILBOXES TRUE
#endif
/**
* @brief Memory checks APIs.
* @details If enabled then the memory checks APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_MEMCHECKS)
#define CH_CFG_USE_MEMCHECKS TRUE
#endif
/**
* @brief Core Memory Manager APIs.
* @details If enabled then the core memory manager APIs are included
@ -631,7 +684,7 @@
* @details User fields added to the end of the @p ch_system_t structure.
*/
#define CH_CFG_SYSTEM_EXTRA_FIELDS \
/* Add threads custom fields here.*/
/* Add system custom fields here.*/
/**
* @brief System initialization hook.
@ -639,7 +692,23 @@
* just before interrupts are enabled globally.
*/
#define CH_CFG_SYSTEM_INIT_HOOK() { \
/* Add threads initialization code here.*/ \
/* Add system initialization code here.*/ \
}
/**
* @brief OS instance structure extension.
* @details User fields added to the end of the @p os_instance_t structure.
*/
#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
/* Add OS instance custom fields here.*/
/**
* @brief OS instance initialization hook.
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
/* Add OS instance initialization code here.*/ \
}
/**
@ -655,6 +724,8 @@
*
* @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs.
*
* @param[in] tp pointer to the @p thread_t structure
*/
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
@ -663,6 +734,8 @@
/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
*
* @param[in] tp pointer to the @p thread_t structure
*/
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
@ -671,6 +744,9 @@
/**
* @brief Context switch hook.
* @details This hook is invoked just before switching between threads.
*
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* Context switch code here.*/ \
@ -745,6 +821,14 @@
/* Trace code here.*/ \
}
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
/* Faults handling code here.*/ \
}
/** @} */
/*===========================================================================*/

View File

@ -1,5 +1,5 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -29,7 +29,7 @@
#define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_1_
#define _CHIBIOS_HAL_CONF_VER_8_4_
#include "mcuconf.h"
@ -335,15 +335,18 @@
/*===========================================================================*/
/**
* @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however.
* This option is recommended also if the SPI driver does not
* use a DMA channel and heavily loads the CPU.
* @brief Timeout before assuming a failure while waiting for card idle.
* @note Time is in milliseconds.
*/
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING TRUE
#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
#define MMC_IDLE_TIMEOUT_MS 1000
#endif
/**
* @brief Mutual exclusion on the SPI bus.
*/
#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define MMC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
@ -415,6 +418,26 @@
#define SERIAL_BUFFERS_SIZE 16
#endif
/*===========================================================================*/
/* SIO driver related settings. */
/*===========================================================================*/
/**
* @brief Default bit rate.
* @details Configuration parameter, this is the baud rate selected for the
* default configuration.
*/
#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
#define SIO_DEFAULT_BITRATE 38400
#endif
/**
* @brief Support for thread synchronization API.
*/
#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
#define SIO_USE_SYNCHRONIZATION TRUE
#endif
/*===========================================================================*/
/* SERIAL_USB driver related setting. */
/*===========================================================================*/
@ -451,11 +474,10 @@
#endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
* @brief Inserts an assertion on function errors before returning.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__)
#define SPI_USE_ASSERT_ON_ERROR TRUE
#endif
/**

View File

@ -1,6 +1,8 @@
#include "hal.h"
#include "persistence.h"
mfs_nocache_buffer_t __nocache_mfsbuf1;
static const MFSConfig mfscfg_1k = {
.flashp = (BaseFlash *)&EFLD1,
.erased = 0xFFFFFFFFU,
@ -47,7 +49,7 @@ int InitConfiguration() {
/* Starting EFL driver.*/
eflStart(&EFLD1, NULL);
mfsObjectInit(&mfs1);
mfsObjectInit(&mfs1, &__nocache_mfsbuf1);
#define FLASH_SIZE_IN_K_ADDRESS 0x1FFFF7E0
int flashSize = (*(uint16_t*)FLASH_SIZE_IN_K_ADDRESS);

View File

@ -22,7 +22,6 @@ static const UARTConfig uartCfg =
.cr1 = 0,
.cr2 = 0,
.cr3 = 0,
.rxhalf_cb = nullptr,
};
static char printBuffer[200];
@ -39,7 +38,7 @@ static void UartThread(void*)
pokeConfiguration();
chThdSleepMilliseconds(200);
chThdSleepMilliseconds(500);
}
}