Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ if(EOS_BUILD_TESTS AND NOT EOS_PRODUCT)
EOS_ENABLE_SENSOR=1
EOS_ENABLE_FILESYSTEM=1
EOS_ENABLE_MOTOR_CTRL=1
EOS_ENABLE_PWM=1
)
message(STATUS " Test features: multicore net power ota sensor filesystem motor_ctrl")
message(STATUS " Test features: multicore net power ota sensor filesystem motor_ctrl pwm")
endif()

# Global include for eos_config.h and product profiles
Expand All @@ -70,6 +71,7 @@ include_directories(
add_library(eos_hal STATIC
hal/src/hal_common.c
hal/src/hal_extended_stubs.c
hal/src/hal_pwm.c
)

# Which backend source is compiled, and which one eos_hal_init() falls back to,
Expand Down
3 changes: 2 additions & 1 deletion STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ is an admission of an unmeasured claim, and should be driven to zero.
| Kernel (task, sync, ipc, multicore, heap) | `libeos_kernel.a` | Experimental | Builds host and Cortex-M4; `test_kernel` passes. Mutex priority inheritance is transitive and recomputed from an invariant. No preemption or latency measurement. |
| HAL — dispatch layer | `libeos_hal.a` | Experimental | `hal_common.c` dispatches to a registered backend; `test_drivers` passes. |
| HAL — host backend | (in `libeos_hal.a`) | **Planned** | `hal_linux.c` implements a Linux backend, but `eos_hal_linux_register()` is **never called and is declared in no public header**. On a host build no backend registers, `eos_hal_init()` returns `-1`, and every HAL call silently no-ops. |
| HAL — extended peripherals (ADC, PWM, I²C, SPI, …) | (in `libeos_hal.a`) | **Planned** | `hal_extended_stubs.c` is 740 of the HAL's 3,185 lines and contains 144 `(void)param;` casts. The API exists; the peripherals do not. |
| HAL — extended peripherals (host) | (in `libeos_hal.a`) | Experimental | `hal_extended_stubs.c` is 707 lines and contains 268 `(void)param;` casts; ADC, I²C, SPI and most other extended peripherals remain stub-only. PWM now has a real host backend (`hal_pwm.c`) — a state-recording stub, not a waveform generator — with `test_pwm` **28/28 pass**. |
| HAL — extended peripherals (STM32F4) | (in `libeos_hal.a`, cross build) | **Planned** | PWM and ADC each have STM32F4 register-level code (`hal_pwm.c`, `hal_extended.c`), but neither is compiled by any build target in this repository: the ARM CI job (`.github/workflows/build.yml`) compiles an explicit source list that omits both files, and the CMake cross-build (`toolchains/arm-cortex-m4.cmake`) sets `EOS_MCU_STM32F4` as a cache variable that is never converted into a compiler `-D` flag either. No test exercises this code, and no ADC test exists at all. |
| Architecture — ARM Cortex-M4 / R5 | 23 `.a` targets | Experimental | Cross-compiles clean via `arm-cortex-m4`, `arm-none-eabi-stm32f4` and `arm-none-eabi-r5`; artifacts verified `armv7e-m` / `armv7` with `objdump -f`. **Never executed** — no board, no QEMU. |
| Architecture — RISC-V, Cortex-A/AArch64 | — | **Unknown** | Toolchain files exist (`riscv64-linux-gnu.cmake`, `aarch64-linux-gnu.cmake`). Neither toolchain was installed, so neither was built. **NOT RUN.** |
| Boards | `boards/*.yaml` | **Planned** | 84 descriptors, of which **71 are named `generic-*`**. A descriptor is not a port; none has been validated on hardware. |
Expand Down
2 changes: 1 addition & 1 deletion hal/include/eos/hal_extended.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void eos_pwm_deinit(uint8_t channel);
int eos_pwm_set_duty(uint8_t channel, uint16_t duty_pct_x10);
int eos_pwm_set_freq(uint8_t channel, uint32_t frequency_hz);
int eos_pwm_start(uint8_t channel);
int eos_pwm_stop(uint8_t channel);
int eos_pwm_stop(uint8_t channel); /* idempotent: 0 if channel is initialized but not running */

#endif /* EOS_ENABLE_PWM */

Expand Down
3 changes: 1 addition & 2 deletions hal/src/hal_extended.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#if defined(EOS_MCU_STM32F4)

#define REG32(addr) (*(volatile uint32_t *)(addr))
#include "hal_stm32f4_regs.h"

/* ================================================================
* Flash — STM32F4 Internal Flash (FLASH_CR/SR at 0x40023C00)
Expand Down Expand Up @@ -207,7 +207,6 @@ int eos_wdt_set_callback(eos_wdt_callback_t cb, void *ctx) {
#define RTC_CR REG32(0x40002808U)
#define RTC_ISR REG32(0x4000280CU)
#define RTC_WPR REG32(0x40002824U)
#define RCC_APB1ENR_REG REG32(0x40023840U)
#define RCC_BDCR REG32(0x40023870U)

static uint8_t bcd_to_bin(uint8_t bcd) { return (bcd >> 4) * 10 + (bcd & 0xF); }
Expand Down
39 changes: 3 additions & 36 deletions hal/src/hal_extended_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,42 +89,9 @@ int eos_dac_write_mv(uint8_t channel, uint32_t millivolts)

/* ---- PWM ---- */
#if EOS_ENABLE_PWM

int eos_pwm_init(const eos_pwm_config_t *cfg)
{
(void)cfg;
return -1;
}

void eos_pwm_deinit(uint8_t channel)
{
(void)channel;
}

int eos_pwm_set_duty(uint8_t channel, uint16_t duty_pct_x10)
{
(void)channel; (void)duty_pct_x10;
return -1;
}

int eos_pwm_set_freq(uint8_t channel, uint32_t frequency_hz)
{
(void)channel; (void)frequency_hz;
return -1;
}

int eos_pwm_start(uint8_t channel)
{
(void)channel;
return -1;
}

int eos_pwm_stop(uint8_t channel)
{
(void)channel;
return -1;
}

/* PWM implementation moved to hal_pwm.c - platform-specific implementations
* for STM32F4 and Linux are provided there
*/
#endif /* EOS_ENABLE_PWM */

/* ---- CAN ---- */
Expand Down
Loading