HALO Workshop – Implementation Task Sheet

Scenario: AMP Battery Charging Supervision System

Objective

Implement a battery charging supervision application on the provided AMP QEMU platform using both a classical approach and a HALO-based approach.

What is already provided

Hart is alias for Core in RISC-V terminology. The platform has 4 harts/cores, each running a different OS or bare-metal code.

What you must implement

Hart1 / Zephyr — SensorFusion

Hart2 / FreeRTOS — ChargeController

Hart3 / Bare-metal — SafetyMonitor

Hart4 / Linux — Supervisor

Interfaces you must use

Interface Write by Read by Purpose Physical Address Range Virtual Address Range (Linux OS)
SensorFrameIfSensorFusionChargeControllerperiodic measurements0x80340000 - 0x80340200 (512 bytes)/
ChargeCommandIfChargeControllerSafetyMonitorcharging command0x80341000 - 0x80341200 (512 bytes)/
ChargeStatusIfChargeControllerSupervisorcontroller status0x80342000 - 0x80342040 (64 bytes)get_external_buffer(offset)
SafetyStateIfSafetyMonitorSupervisorsafety state0x80343000 - 0x80343040 (64 bytes)get_external_buffer(offset)
OperatorCommandIfSupervisorChargeControllerstructured internal command0x80344000 - 0x80344010 (16 bytes) get_external_buffer(offset)

Minimum interface contents

SensorFrameIf

fault_flags definition (bitmask, uint32):

Multiple faults can be set at once using bitwise OR. Example: fault_flags = 0x03 means over-temperature and over-current.

ChargeCommandIf

Allowed values for charging_mode: "normal", "fast".

ChargeStatusIf

Allowed values for charger_state: "idle", "charging", "complete", "fault".

SafetyStateIf

OperatorCommandIf

Allowed values for command_id:

For unknown command_id values, ignore the command and set an appropriate fault or log entry.

Example commands

Required scenarios

Nominal scenario

  1. Zephyr reads virtual sensor values
  2. Zephyr publishes SensorFrameIf
  3. FreeRTOS computes charging decision
  4. FreeRTOS publishes ChargeCommandIf and ChargeStatusIf
  5. Bare-metal updates SafetyStateIf
  6. Linux displays current controller and safety state
  7. User sends a UART command
  8. Linux parses it and forwards OperatorCommandIf
  9. FreeRTOS applies the command and updates status

Acceptance checklist

Workshop Group Allocation

  1. Five groups as G1 through G5.
  2. Group will either start with the classical implementation or the HALO-based implementation first depending on the slip drawn, then switch to the other approach after a fixed time:
    • Two slips: Classical -> HALO
    • Three slips: HALO -> Classical
  3. Slips will be shuffled thoroughly in view of participants.
  4. One representative from each group will draw exactly one slip.
  5. Allocation will be immediately recorded in a log table with the following fields:
    • Group ID
    • Assigned order
    • Time

HALO system description (HADL)

HALO participants must create their HADL system description files in /workspaces/PhdHaloRSG/halo_dist/hadls. After adding or updating HADL files, compose and generate the HALO framework packages using the VS Code tasks named Halo: Compose and Halo: Generate (available in the workspace Tasks menu).

Guidance: When creating a new HALO system, follow this recommended naming for consistency with other groups:
  1. ADL file: battery_charging_system.adl — Define your system architecture and components first.
  2. IDDL file: battery_charging_system.iddl — Specify your interface data types and structures.
  3. IDL file: battery_charging_system.idl — Define the interface contracts and method integrity (if needed) that you outlined in ADL description.
  4. HML file: battery_charging_system.hml — Add profiles that you outlined in ADL description.

ADL Component Platform & Connection Profile Guidelines

Suggestion: Name each connection after the interface it uses, omitting the If suffix. For example, use SensorTelemetry for SensorFrameIf, ChargingCommand for ChargeCommandIf, etc.

Component Platform Names

When defining components, use the following platform names:

Connections and Profile Mapping

HALO Profiles

Profiles are built-in — use the following directly in your HML connection definitions.

See the HALO Guide for details and examples of attribute usage: HALO Guide — Profiles.

Tip: HALO-specific code snippets are available in VS Code. Just type hml in a HML file or IDL in IDL file etc. Snippets are defined in .vscode/hadl.code-snippets in this workspace.

See an example HADL workflow in the Getting Started guide: Getting Started — example.

Appendix: Diagrams

System overview

System design diagram

Communication flow

Normal communication flow diagram