Skip to content

Merisy-Thing/rust_hal_with_c_sdk_framework

Repository files navigation

Rust HAL with C SDK Framework

Introduction

This is a Rust HAL framework to be bound to the MCU C SDK/BSP.

Ownership restrictions friendly, almost all types can be Copy/Clone.

Description

Startup and runtime

  • Use cortexm-rt or riscv-rt directly, referring to the implementation of ll_bind_hk32F0301mxxc
  • Use the SDK/BSP startup_XXX.S, refer to the implementation of ll_bind_ch32v20x

Interrupt

  • Can be fully implemented in C to facilitate the clear of interrupt flags
  • Handle HAL or application data via rust-defined hook callback function

HAL hook

Features

  • print-log = []: print!,println! print logs via serial port
  • tick-size-64bit = []: The tick counter uses 64 bits, default is 32 bits
  • Embassy = []: Embassy timer driver and GPIO input asynchronous support
  • USART-[0..7] = []: Serial port receive cache and callback ID definition
  • adc-data-type-u8 = [] : Use 8-bit ADC data type, 16-bit by default
  • adc-buffered-ch[0..7] = []: ADC cache and callback definitions
  • exti-irq-callback = [] : exti interrupt callback, which needs to be defined by the App
  • print-log-csdk = ["print-log"]: print!, println! use formatting function from CSDK to output logs, Save 2-6KB, refer to example_ch32v/examples/print.rs

print-log-csdk print log limits

  • Add %S and %y lable to format strings and arrays with length parameters, refer to ll_bind_ch32v20x\csrc\print.c
  • Not support padding

Architecture


输入图片说明

About

Rust HAL framework to be bound to the MCU C SDK/BSP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published