Skip to content

HAL module for Microchip devices

Notifications You must be signed in to change notification settings

zephyrproject-rtos/hal_microchip

Folders and files

NameName
Last commit message
Last commit date
Mar 12, 2025
Dec 13, 2024
Mar 1, 2024
Mar 21, 2025
Apr 8, 2022
Feb 18, 2025
Dec 13, 2024
Mar 12, 2025
May 14, 2024
Mar 12, 2025
Dec 13, 2024
Mar 12, 2025
Oct 17, 2024

Repository files navigation

Introduction

The hal_microchip is a set of register definitions for Microchip PIC32C/PIC32M SoC's. The HAL is organized following the directory structure detailed below.

Directory Structure

The directory is composed of:

.
├── CMakeLists.txt
├── dts
│   └── microchip
│       └── mec5
│           ├── MEC5 PINCTRL DTSI files
├── include
│   └── dt-bindings
│       └── pinctrl
│           ├── PIC32CX PINCTRL C header files
├── mec
│   ├── Legacy MEC150x/2x C chip and peripheral header files
├── mec5
│   ├── CMakeLists.txt
│   ├── devices
│   │   ├── MEC5 HAL chip and peripheral header files
│   └── drivers
│       ├── MEC5 HAL peripheral C source files
├── mpfs
│   ├── PolarFire board and HAL files
├── pic32c
│   ├── PIC32CX chip and peripheral HAL files
├── pinconfigs
│   ├── PIC32CX pin config definition XML
├── README.md
├── scripts
│   ├── PIC32C Python pin config generation scripts
└── zephyr
    └── module.yml

  • MEC5 chips Zephyr device tree PINCFG DTSI files
  • PIC32C SoC specific include libraries.
  • Includes specific for these platforms
    • devicetree bindings
  • Legacy MEC152x header files
  • MEC5 HAL chip and peripheral header and C source files
  • PIC32C Pin definitions
  • This README file
  • PIC32C Scripts used for code generation
  • ZephyrRTOS module directory (zephyr).

How to submit code

Any contribution should follow the How to submit code using as premisses the Zephyr Contribution Guidelines. For more information about External Modules see Modules Section in special Submitting Changes to Modules

MEC5 HAL

The MEC5 HAL currently support Microchip MEC172x (named MECH172x in Zephyr SoC), MEC174x, and MEC175x.
On the Zephyr side the SoC layer build rules set CONFIG_HAS_MEC5_HAL=y.
The top level CMakeLists.txt then processes the hal_microchip/mec5 subfolder.
The MEC5 HAL device is chosen using Zephyr CONFIG_SOC_SERIES and CONFIG_SOC.
Zephyr SoC layer soc.h for MECH172x, MEC174x, and MEC175x include device_mec5.h from the MEC5 HAL.
Zephyr drivres and applications should include individual HAL API headers to access specific peripherals.

MPFS PolarFile HAL

The Microchip Polarfire SOC HAL was downloaded from:

https://github.com/polarfire-soc/platform

Addditionally, the bare metal samples from https://github.com/polarfire-soc/polarfire-soc-bare-metal-examples are required to extract the Icicle Kit bopard configuration files.

Both are from Tag 21.08

The following changes were made:

  • platform-2021.08 top folder renamed to mpfs and located at modules/hal/microchip
  • The applications/mpfs-pmp-demo/mpfs-pmp-app-u54-1/src/boards folder is copied to modules/hal/microchip/mpfs

PIC32C Repository specific guidelines

  • When submitting an updated firmware library version, it is important to make sure that the last firmware version will be merged. The library version is used to be checked at Microchip packs download site.
  • When submitting an updated firmware library version the patchset already applied should be rebased on top of the newer version.
  • The patchset must be sent as an individual commit per SoC series to easy rebase.
  • This repository is managed mainly on Linux. This means that changes should be submitted using Linux LF format. Usually running a similar command to find * type f -print0 | xargs -0 dos2unix -k should be enough.
  • Make sure directory structure is respected.
  • The pic32c/[pic32cxsg]/include/<soc>/README file should be updated accordingly. If for some reason the file not exists it should be created.
  • Directory names should be converted to lowercase.
  • The recommendation is add all fixups in the hal_microchip instead on the ZephyrRTOS project.

The above are general guidelines and exceptions could happen. In this case, the exception should be addressed at review phase.

PIC32C Standard API

The PIC32C/PIC32M standard API define all information to access Microchip SoC's peripherals. This library does not have namespaces and prefixes which easily results in name collision with ZephyrRTOS core and libraries. To avoid that situation, macros, enum values and function names should follow two general rules:

  • Public API functions must be prefixed with pic32cxsg_ or .
  • Public defines and enum values must be uppercase and prefixed with PIC32CXSG_ or .

About

HAL module for Microchip devices

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages