Fix all 8 firmware bugs with regression tests
Bugs fixed in adf4382a_manager.c: - Bug #1: Move initialized=true before sync setup, propagate sync failure - Bug #3: Implement TriggerTimedSync with sw_sync pulse (was no-op) - Bug #5: Replace GPIO-only placeholder with TIM3 PWM for DELADJ - Bug #7: Correct GPIOG pin definitions to match CubeMX (pins 6-15) Bugs fixed in main.cpp: - Bug #2: Remove pre-reset ad9523_setup() call (keep only post-reset) - Bug #4: Move init error check before phase shift calls - Bug #6: Fix timer variable (last_check -> last_check1) in temp block - Bug #8: Uncomment uart_print/uart_println debug helpers Test harness updates: - All 8 tests rewritten to assert correct post-fix behavior - Added TIM PWM mock (SPY_TIM_PWM_START/STOP/SET_COMPARE) - Added mock_adf4382_set_timed_sync_retval for failure injection - Updated shims and Makefile for new test dependencies - All 8 tests pass: make clean && make test -> 8/8 passed
This commit is contained in:
1 parent
b93ee04592
commit
397969348e
17 files changed
+640
-572
No files matched your search
@@ -102,6 +102,7 @@ extern SPI_HandleTypeDef hspi1, hspi4;
|
||||
extern I2C_HandleTypeDef hi2c1, hi2c2;
|
||||
extern UART_HandleTypeDef huart3;
|
||||
extern ADC_HandleTypeDef hadc3;
|
||||
extern TIM_HandleTypeDef htim3; /* Timer for DELADJ PWM */
|
||||
|
||||
/* ========================= SPY / RECORDING LAYER ================== */
|
||||
|
||||
@@ -129,6 +130,9 @@ typedef enum {
|
||||
SPY_AD9523_REMOVE,
|
||||
SPY_NO_OS_UDELAY,
|
||||
SPY_ADS7830_MEASURE,
|
||||
SPY_TIM_PWM_START,
|
||||
SPY_TIM_PWM_STOP,
|
||||
SPY_TIM_SET_COMPARE,
|
||||
} SpyCallType;
|
||||
|
||||
typedef struct {
|
||||
@@ -183,6 +187,21 @@ HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, u
|
||||
void no_os_udelay(uint32_t usecs);
|
||||
void no_os_mdelay(uint32_t msecs);
|
||||
|
||||
/* ========================= TIM / PWM stubs ======================== */
|
||||
|
||||
#define TIM_CHANNEL_1 0x00U
|
||||
#define TIM_CHANNEL_2 0x04U
|
||||
#define TIM_CHANNEL_3 0x08U
|
||||
#define TIM_CHANNEL_4 0x0CU
|
||||
|
||||
HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
|
||||
HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
|
||||
void mock_tim_set_compare(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t Compare);
|
||||
|
||||
/* Macro form that the real STM32 HAL uses */
|
||||
#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__) \
|
||||
mock_tim_set_compare((__HANDLE__), (__CHANNEL__), (__COMPARE__))
|
||||
|
||||
/* ========================= ADS7830 stub =========================== */
|
||||
|
||||
uint8_t ADS7830_Measure_SingleEnded(ADC_HandleTypeDef *hadc, uint8_t channel);
|
||||
|
||||
Reference in new issue
Block a user