#hal #define #flash #peripheral #peripheral-access-crate #s32k1xx

nightly s32k1xx-hal

Hardware Abstraction Layer (HAL) for the S32K1xx Family

1 unstable release

Uses new Rust 2024

0.1.0 Apr 23, 2026

#2110 in Hardware support

GPL-3.0-or-later

71MB
2M SLoC

S32K1XX Hardware Abstraction layer

This repository contains peripheral access crates (PAC) and hardware abstract layer (HAL) crate for dealing with the S32K1 General-Purpose MCUs.

Usage

You can have a look at the example project s32k144-evb on how to use the various abstractions.

Warning

The S32K1xx devices can be locked out by flashing bytes at specific memory location.

You must define the following section in your linked script.

SECTIONS
{
  .flash_config 0x400 :
  {
    KEEP(*(.flash_config));
  } > FLASH
} INSERT AFTER .vector_table;

Then, you must fill it with the following content.

#[repr(C, packed)]
struct FlashConfig {
    backdoor_key: [u8; 8],
    fprot: [u8; 4],
    fsec: u8,
    fopt: u8,
    feprot: u8,
    fdprot: u8,
}

#[used]
#[unsafe(link_section = ".flash_config")]
#[unsafe(no_mangle)]
static FLASH_CONFIG: FlashConfig = FlashConfig {
    backdoor_key: [0xFF; 8],
    fprot: [0xFF; 4],
    fsec: 0xFE,
    fopt: 0xFF,
    feprot: 0xFF,
    fdprot: 0xFF,
};

Crates

The following table lists the crates that are available for use.

Crate Description
s32k1xx-pac Peripheral access crate (PAC) for the S32K1xx family.
s32k1xx-hal Hardware abstraction layer (HAL) for the S32K1xx family.
s32k1xx-pin Pin definitions for the S32K1xx family.

The following table lists the crates used for development only.

Crate Description
s32k144-evb Example project for the S32K144 development board.
s32k1xx-pin-codegen Tool to generate pin informations for the S32K1xx family.
svdedit Tool to modify SVD files of the S32K1xx family.

Limitations

The SVD files for S32K14xW do not have standard Cortex-M4 registers (e.g. NVIC), althought they should have it. This prevents S32K14xW PACs to work with s32k1xx-hal for now.

Dependencies

~4.5MB
~85K SLoC