Skip to content

Commit

Permalink
make chconf.h more similar to each other
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Oct 31, 2024
1 parent 8fd23ec commit 0dba68b
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 72 deletions.
6 changes: 0 additions & 6 deletions firmware/hw_layer/ports/chconf_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
#ifndef CONFIG_CHCONF_COMMON_H_
#define CONFIG_CHCONF_COMMON_H_

#define PORT_IDLE_THREAD_STACK_SIZE 32

// See global_shared.h notes about stack requirements
// see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
#define PORT_INT_REQUIRED_STACK 128

#define CHPRINTF_USE_FLOAT TRUE

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion firmware/hw_layer/ports/stm32/stm32f4/cfg/chconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE
#define CH_CFG_USE_TM FALSE
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions firmware/hw_layer/ports/stm32/stm32f7/cfg/chconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE
#define CH_CFG_USE_TM FALSE
#endif

/**
Expand Down Expand Up @@ -324,7 +324,7 @@
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/
#if !defined(CH_CFG_USE_DYNAMIC)
#define CH_CFG_USE_DYNAMIC TRUE
#define CH_CFG_USE_DYNAMIC FALSE
#endif

/** @} */
Expand Down
4 changes: 2 additions & 2 deletions firmware/hw_layer/ports/stm32/stm32h7/cfg/chconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE
#define CH_CFG_USE_TM FALSE
#endif

/**
Expand Down Expand Up @@ -308,7 +308,7 @@
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/
#if !defined(CH_CFG_USE_DYNAMIC)
#define CH_CFG_USE_DYNAMIC TRUE
#define CH_CFG_USE_DYNAMIC FALSE
#endif

/** @} */
Expand Down
132 changes: 72 additions & 60 deletions simulator/chconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@
#define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_1_

#define CHPRINTF_USE_FLOAT TRUE
/*
* __process_stack_size__ and __process_stack_size__ defaults are each hard-coded as 0x400 in ChibiOS rules.mk files
* rusEfi do not override these defaults.
*
* http://www.chibios.com/forum/viewtopic.php?t=309
* "__main_stack_size__ is the size of INTERRUPTS stack"
* "__process_stack_size__ is the stack of the C-runtime, in ChibiOS the "main" thread uses the C-runtime stack."
*
*/


#include "../firmware/hw_layer/ports/chconf_common.h"

/*===========================================================================*/
/**
Expand Down Expand Up @@ -313,6 +324,28 @@
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif

/**
* @brief Dynamic Threads APIs.
* @details If enabled then the dynamic threads creation APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/
#if !defined(CH_CFG_USE_DYNAMIC)
#define CH_CFG_USE_DYNAMIC TRUE
#endif

/** @} */

/*===========================================================================*/
/**
* @name OSLIB options
* @{
*/
/*===========================================================================*/

/**
* @brief Mailboxes APIs.
* @details If enabled then the asynchronous messages (mailboxes) APIs are
Expand All @@ -325,6 +358,14 @@
#define CH_CFG_USE_MAILBOXES TRUE
#endif

/**
* @brief I/O Queues APIs.
* @details If enabled then the I/O queues APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#define CH_CFG_USE_QUEUES FALSE

/**
* @brief Core Memory Manager APIs.
* @details If enabled then the core memory manager APIs are included
Expand All @@ -336,6 +377,21 @@
#define CH_CFG_USE_MEMCORE TRUE
#endif

/**
* @brief Managed RAM size.
* @details Size of the RAM area to be managed by the OS. If set to zero
* then the whole available RAM is used. The core memory is made
* available to the heap allocator and/or can be used directly through
* the simplified core memory allocator.
*
* @note In order to let the OS manage the whole RAM the linker script must
* provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE.
*/
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0
#endif

/**
* @brief Heap Allocator APIs.
* @details If enabled then the memory heap allocator APIs are included
Expand All @@ -358,11 +414,11 @@
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE
#define CH_CFG_USE_MEMPOOLS FALSE
#endif

/**
* @brief Objects FIFOs APIs.
* @brief Objects FIFOs APIs.
* @details If enabled then the objects FIFOs APIs are included
* in the kernel.
*
Expand Down Expand Up @@ -416,19 +472,6 @@
#define CH_CFG_USE_JOBS FALSE
#endif

/**
* @brief Dynamic Threads APIs.
* @details If enabled then the dynamic threads creation APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/
#if !defined(CH_CFG_USE_DYNAMIC)
#define CH_CFG_USE_DYNAMIC TRUE
#endif

/** @} */

/*===========================================================================*/
Expand Down Expand Up @@ -493,6 +536,13 @@
#define CH_CFG_FACTORY_OBJ_FIFOS FALSE
#endif

/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif

/** @} */

/*===========================================================================*/
Expand Down Expand Up @@ -522,9 +572,6 @@
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
#endif

#define ON_LOCK_HOOK
#define ON_UNLOCK_HOOK

/**
* @brief Debug option, parameters checks.
* @details If enabled then the checks on the API functions input
Expand Down Expand Up @@ -631,25 +678,6 @@
/* Add threads initialization code here.*/ \
}

/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
*/
#define CH_CFG_THREAD_EXTRA_FIELDS \
unsigned char threadId; \
/* Add threads custom fields here.*/

/**
* @brief Threads initialization hook.
* @details User initialization code added to the @p _thread_init() function.
*
* @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs.
*/
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
}

/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
Expand All @@ -658,28 +686,6 @@
/* Add threads finalization code here.*/ \
}

/**
* @brief Context switch hook.
* @details This hook is invoked just before switching between threads.
*/
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* Context switch code here.*/ \
}

/**
* @brief ISR enter hook.
*/
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
/* IRQ prologue code here.*/ \
}

/**
* @brief ISR exit hook.
*/
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
/* IRQ epilogue code here.*/ \
}

/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
Expand Down Expand Up @@ -746,6 +752,12 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/

/**
* @brief Sleep at idle.
* @details This option enables call to __WFI() from idle thread to save power.
*/
#define CORTEX_ENABLE_WFI_IDLE TRUE

#endif /* CHCONF_H */

/** @} */
2 changes: 1 addition & 1 deletion simulator/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
* even while it does not help with https://github.com/rusefi/rusefi/issues/794
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 1024
#define SERIAL_BUFFERS_SIZE 65536
#endif

/*===========================================================================*/
Expand Down

0 comments on commit 0dba68b

Please sign in to comment.