Skip to content
Open
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
53 changes: 53 additions & 0 deletions .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build ML examples
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '30 22 28 * 0'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would only run by schedule if day 28 of a month happens to be a Sunday.

Suggested change
- cron: '30 22 28 * 0'
- cron: '30 22 * * 0'


jobs:
build-target:
name: Build target

strategy:
fail-fast: true
matrix:
context: [object-detection.Debug+Alif-E7-M55-HP, object-detection.Debug+AVH-SSE-300-U55, kws.Debug+Alif-E7-M55-HE, kws.Debug+AVH-SSE-310-U65, kws.Debug+FRDM-K64F, kws.Debug+STM32F746-DISCO]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for not building the release contexts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. Should I add both release and debug contexts?


runs-on: ubuntu-latest

env:
ARM_UBL_ACTIVATION_CODE: ${{secrets.ARM_UBL_ACTIVATION_CODE}}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup vcpkg environment
uses: JonatanAntoni/actions/vcpkg@main
with:
config: vcpkg-configuration.json

- name: Activate Arm tool license
run: |
if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
armlm activate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
else
armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
fi

- name: Build target
run: cbuild mlek.csolution.yml --update-rte --packs --schema --context ${{ matrix.context }}

- name: Deactivate Arm tool license
if: always()
run: |
if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then
armlm deactivate --code ${{ env.ARM_UBL_ACTIVATION_CODE }}
else
armlm deactivate --product KEMDK-COM0
fi

26 changes: 9 additions & 17 deletions device/alif-ensemble/alif-ensemble-E7-device.clayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@ layer:
- component: AlifSemiconductor::Device:Startup
- component: ARM::CMSIS Driver:USART
- component: ARM::CMSIS Driver:USART:Custom
- component: AlifSemiconductor::Device:SE Services:SE RunTime services&Source
- component: AlifSemiconductor::Device:SE Services:MHU Driver
- component: AlifSemiconductor::Device:SE runtime Services:core&Source
- component: AlifSemiconductor::Device:SOC Peripherals:MHU
- component: AlifSemiconductor::Device:SOC Peripherals:CPI
- component: AlifSemiconductor::Device:SOC Peripherals:I2C
- component: AlifSemiconductor::Device:SOC Peripherals:MIPI CSI2
- component: AlifSemiconductor::Device:SOC Peripherals:MIPI DSI
- component: AlifSemiconductor::BSP:External peripherals:ILI9806E LCD panel
- component: AlifSemiconductor::BSP:External peripherals:CAMERA Sensor ARX3A0

- component: AlifSemiconductor::Device:SOC Peripherals:DMA
for-context: +Alif-E7-M55-HE
Expand All @@ -79,20 +85,6 @@ layer:
- component: AlifSemiconductor::Device:SOC Peripherals:I3C
for-context: +Alif-E7-M55-HP

- component: AlifSemiconductor::Device:SOC Peripherals:CDC200
- component: AlifSemiconductor::Device:SOC Peripherals:CDC
for-context: +Alif-E7-M55-HP

- component: AlifSemiconductor::Device:SOC Peripherals:MIPI CSI2
for-context: +Alif-E7-M55-HP

- component: AlifSemiconductor::Device:SOC Peripherals:MIPI DSI
for-context: +Alif-E7-M55-HP

- component: AlifSemiconductor::Device:SOC Peripherals:CAMERA Controller
for-context: +Alif-E7-M55-HP

- component: AlifSemiconductor::BSP:External peripherals:ILI9806E LCD panel
for-context: +Alif-E7-M55-HP

- component: AlifSemiconductor::BSP:External peripherals:CAMERA Sensor ARX3A0
for-context: +Alif-E7-M55-HP
8 changes: 2 additions & 6 deletions device/alif-ensemble/include/CameraCapture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@
#ifndef CAMERA_CAPTURE_HPP
#define CAMERA_CAPTURE_HPP

#if defined (__cplusplus)
extern "C" {
#include "Camera_Common.h"
}
#endif
#include <cstdint>

#define CAMERA_FRAME_WIDTH 560
#define CAMERA_FRAME_HEIGHT 560
#define CAMERA_RESOLUTION_560x560 0
#define CAMERA_RESOLUTION CAMERA_RESOLUTION_560x560
#define CAMERA_IMAGE_RAW_SIZE (CAMERA_FRAME_WIDTH * CAMERA_FRAME_HEIGHT)

Expand All @@ -48,7 +44,7 @@ enum class ColourFilter {
* @param raw_image Pointer to the raw image that can be populated.
* @return int: 0 if successful, error code otherwise
*/
int CameraCaptureInit(ARM_CAMERA_RESOLUTION resolution);
int CameraCaptureInit(uint8_t* resolution);

/**
* @brief Starts the camera capture (does not wait for it to finish)
Expand Down
2 changes: 1 addition & 1 deletion device/alif-ensemble/include/GpioSignal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
extern "C" {
#endif // #if defined(__cplusplus)

#include "gpio.h"
#include "../src/gpio.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty unusual. Header files placed into the src folder are typically considered "private" while ones in include folder represent the "public interface".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the type definitions required in this file was not present in the pack's gpio.h and only in src/gpio.h. Would it better to remove the include and simply move the type definition into this file itself?


#if defined(__cplusplus)
}
Expand Down
23 changes: 8 additions & 15 deletions device/alif-ensemble/src/BoardAudioUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern "C" {

#include "RTE_Components.h"
#include "RTE_Device.h"
#include <Driver_PINMUX_AND_PINPAD.h>
#include "pinconf.h"
#include <Driver_SAI.h>
#include CMSIS_device_header

Expand All @@ -45,9 +45,9 @@ static volatile audio_capture_state s_cap_state;

static void set_capture_completed(bool val)
{
NVIC_DisableIRQ((IRQn_Type)I2S2_IRQ);
NVIC_DisableIRQ((IRQn_Type)I2S2_IRQ_IRQn);
s_cap_state.capCompleted = val;
NVIC_EnableIRQ((IRQn_Type)I2S2_IRQ);
NVIC_EnableIRQ((IRQn_Type)I2S2_IRQ_IRQn);
}

static void set_capture_started(bool val)
Expand Down Expand Up @@ -77,21 +77,14 @@ static int32_t ConfigureI2SPinMuxPinPad()
{
int32_t status = 0;

// Configure P2_1.I2S2_SDI_A
status |= PINMUX_Config(PORT_NUMBER_2, PIN_NUMBER_1, PINMUX_ALTERNATE_FUNCTION_3);
status |=
PINPAD_Config(PORT_NUMBER_2,
PIN_NUMBER_1,
PAD_FUNCTION_DRIVER_DISABLE_STATE_WITH_PULL_DOWN | PAD_FUNCTION_READ_ENABLE);
// Configure P8_1.I2S2_SDI_A
pinconf_set(PORT_8, PIN_1, PINMUX_ALTERNATE_FUNCTION_1, PADCTRL_READ_ENABLE | PADCTRL_DRIVER_DISABLED_PULL_UP);

/* Configure P2_3.I2S2_SCLK_A */
status |= PINMUX_Config(PORT_NUMBER_2, PIN_NUMBER_3, PINMUX_ALTERNATE_FUNCTION_3);
status |= PINPAD_Config(PORT_NUMBER_2, PIN_NUMBER_3, PAD_FUNCTION_READ_ENABLE);
/* Configure P8_3.I2S2_SCLK_A */
pinconf_set(PORT_8, PIN_3, PINMUX_ALTERNATE_FUNCTION_1, PADCTRL_READ_ENABLE);

/* Configure P2_3.I2S2_WS_A */
status |= PINMUX_Config(PORT_NUMBER_2, PIN_NUMBER_4, PINMUX_ALTERNATE_FUNCTION_2);
status |= PINPAD_Config(PORT_NUMBER_2, PIN_NUMBER_4, PAD_FUNCTION_READ_ENABLE);

pinconf_set(PORT_8, PIN_4, PINMUX_ALTERNATE_FUNCTION_1, PADCTRL_READ_ENABLE);
return status;
}

Expand Down
43 changes: 18 additions & 25 deletions device/alif-ensemble/src/BoardInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ extern "C" {
#include "RTE_Components.h"
#include "RTE_Device.h"
#include CMSIS_device_header
#include "Driver_PINMUX_AND_PINPAD.h"
#include "Driver_GPIO.h"
#include "pinconf.h"
#include "Driver_Common.h"
#include "ethosu_driver.h"
#include "uart_stdout.h"
#include <stdio.h>

#define LOCAL_PERIPHERAL_BASE (0x40000000UL)

static struct ethosu_driver npuDriver;
static void npu_irq_handler(void)
{
Expand Down Expand Up @@ -58,8 +61,13 @@ bool NpuInit()
return false;
}

NVIC_SetVector(NPU_IRQ, (uint32_t) &npu_irq_handler);
NVIC_EnableIRQ(NPU_IRQ);
#if defined (M55_HP)
NVIC_SetVector(NPU_HP_IRQ_IRQn, (uint32_t) &npu_irq_handler);
NVIC_EnableIRQ(NPU_HP_IRQ_IRQn);
#elif defined(M55_HE)
NVIC_SetVector(NPU_HE_IRQ_IRQn, (uint32_t) &npu_irq_handler);
NVIC_EnableIRQ(NPU_HE_IRQ_IRQn);
#endif

return true;
}
Expand All @@ -73,7 +81,7 @@ static void CpuCacheEnable(void)
{
/* Enable I-Cache */
SCB_EnableICache();

/* Enable D-Cache */
SCB_EnableDCache();
}
Expand All @@ -82,42 +90,27 @@ static void CpuCacheEnable(void)

static int I3CPinsInit(void)
{
/* Configure GPIO Pin : P3_8 as I3C_SDA_B */
int ret = PINMUX_Config(PORT_NUMBER_3, PIN_NUMBER_8, PINMUX_ALTERNATE_FUNCTION_3);
if(ret != ARM_DRIVER_OK) {
return ret;
}

/* Configure GPIO Pin : P3_9 as I3C_SCL_B */
ret = PINMUX_Config(PORT_NUMBER_3, PIN_NUMBER_9, PINMUX_ALTERNATE_FUNCTION_4);
if(ret != ARM_DRIVER_OK) {
return ret;
}

/* Pin-Pad P3_8 as I3C_SDA_B
/* Configure GPIO Pin : P1_2 as I3C_SDA_B */
/* Pin-Pad P1_2 as I3C_SDA_B
* Pad function: PAD_FUNCTION_READ_ENABLE |
* PAD_FUNCTION_DRIVER_DISABLE_STATE_WITH_PULL_UP |
* PAD_FUNCTION_DRIVER_OPEN_DRAIN
*/
ret = PINPAD_Config(PORT_NUMBER_3, PIN_NUMBER_8, PAD_FUNCTION_READ_ENABLE |
PAD_FUNCTION_DRIVER_DISABLE_STATE_WITH_PULL_UP |
PAD_FUNCTION_DRIVER_OPEN_DRAIN);
int ret = pinconf_set(PORT_1, PIN_2, PINMUX_ALTERNATE_FUNCTION_3, PADCTRL_READ_ENABLE | PADCTRL_DRIVER_DISABLED_PULL_UP | PADCTRL_DRIVER_OPEN_DRAIN);
if(ret != ARM_DRIVER_OK) {
return ret;
}

/* Pin-Pad P3_9 as I3C_SCL_B
/* Configure GPIO Pin : P1_3 as I3C_SCL_B */
/* Pin-Pad P1_3 as I3C_SCL_B
* Pad function: PAD_FUNCTION_READ_ENABLE |
* PAD_FUNCTION_DRIVER_DISABLE_STATE_WITH_PULL_UP |
* PAD_FUNCTION_DRIVER_OPEN_DRAIN
*/
ret = PINPAD_Config(PORT_NUMBER_3, PIN_NUMBER_9,PAD_FUNCTION_READ_ENABLE |
PAD_FUNCTION_DRIVER_DISABLE_STATE_WITH_PULL_UP |
PAD_FUNCTION_DRIVER_OPEN_DRAIN);
ret = pinconf_set(PORT_1, PIN_3, PINMUX_ALTERNATE_FUNCTION_3, PADCTRL_READ_ENABLE | PADCTRL_DRIVER_DISABLED_PULL_UP | PADCTRL_DRIVER_OPEN_DRAIN);
if(ret != ARM_DRIVER_OK) {
return ret;
}

return 0;
}

Expand Down
39 changes: 20 additions & 19 deletions device/alif-ensemble/src/CameraCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ extern "C" {

#include "RTE_Components.h"
#include CMSIS_device_header
#include "Driver_Camera_Controller.h"
#include "Driver_CPI.h"
#include "system_utils.h"
#include "Driver_Common.h"
#include "Driver_GPIO.h"
#include "Driver_PINMUX_AND_PINPAD.h"
#include "log_macros.h"

extern ARM_DRIVER_GPIO Driver_GPIO1;
extern ARM_DRIVER_CAMERA_CONTROLLER Driver_CAMERA0;
extern ARM_DRIVER_CPI Driver_CPI;

static struct arm_camera_status {
bool frame_complete: 1;
Expand All @@ -53,19 +53,20 @@ static struct arm_camera_status {

static void camera_event_cb(uint32_t event)
{
if(event & ARM_CAMERA_CONTROLLER_EVENT_CAMERA_FRAME_VSYNC_DETECTED) {

if(event & ARM_CPI_EVENT_CAMERA_FRAME_VSYNC_DETECTED) {
camera_status.frame_complete = true;
}

if(event & ARM_CAMERA_CONTROLLER_EVENT_ERR_CAMERA_FIFO_OVERRUN) {
if(event & ARM_CPI_EVENT_ERR_CAMERA_INPUT_FIFO_OVERRUN) {
camera_status.camera_error = true;
}

if(event & ARM_CAMERA_CONTROLLER_EVENT_ERR_CAMERA_FIFO_UNDERRUN) {
if(event & ARM_CPI_EVENT_ERR_CAMERA_OUTPUT_FIFO_OVERRUN) {
camera_status.camera_error = true;
}

if(event & ARM_CAMERA_CONTROLLER_EVENT_MIPI_CSI2_ERROR) {
if(event & ARM_CPI_EVENT_MIPI_CSI2_ERROR) {
camera_status.camera_error = true;
}
}
Expand All @@ -78,38 +79,38 @@ __attribute__((noreturn)) static void CameraErrorLoop(const char* errorStr)
{
printf_err("%s\n", errorStr);
while(true) {
Driver_GPIO1.SetValue(PIN_NUMBER_14, GPIO_PIN_OUTPUT_STATE_LOW);
PMU_delay_loop_us(300000);
Driver_GPIO1.SetValue(PIN_NUMBER_14, GPIO_PIN_OUTPUT_STATE_HIGH);
PMU_delay_loop_us(300000);
Driver_GPIO1.SetValue(1, GPIO_PIN_OUTPUT_STATE_LOW);
sys_busy_loop_us(300000);
Driver_GPIO1.SetValue(1, GPIO_PIN_OUTPUT_STATE_HIGH);
sys_busy_loop_us(300000);
}
}

int arm::app::CameraCaptureInit(ARM_CAMERA_RESOLUTION resolution)
int arm::app::CameraCaptureInit(uint8_t* resolution)
{
if (0 != Driver_CAMERA0.Initialize(resolution, camera_event_cb)) {
if (0 != Driver_CPI.Initialize(camera_event_cb)) {
CameraErrorLoop("Camera initialisation failed.\n");
}

if (0 != Driver_CAMERA0.PowerControl(ARM_POWER_FULL)) {
if (0 != Driver_CPI.PowerControl(ARM_POWER_FULL)) {
CameraErrorLoop("Camera power up failed.\n");
}

if (0 != Driver_CAMERA0.Control(CAMERA_SENSOR_CONFIGURE, resolution)) {
if (0 != Driver_CPI.Control(CPI_CAMERA_SENSOR_CONFIGURE, 0)) {
CameraErrorLoop("Camera configuration failed.\n");
}

info("Camera initialised.\n");
Driver_GPIO1.SetValue(PIN_NUMBER_14, GPIO_PIN_OUTPUT_STATE_HIGH);
// Driver_GPIO1.SetValue(PIN_NUMBER_14, GPIO_PIN_OUTPUT_STATE_HIGH);
return 0;
}

static inline void CameraStatusReset()
{
NVIC_DisableIRQ((IRQn_Type) CAMERA0_IRQ);
NVIC_DisableIRQ((IRQn_Type) CAM_IRQ_IRQn);
camera_status.frame_complete = false;
camera_status.camera_error = false;
NVIC_EnableIRQ((IRQn_Type) CAMERA0_IRQ);
NVIC_EnableIRQ((IRQn_Type) CAM_IRQ_IRQn);
}

int arm::app::CameraCaptureStart(uint8_t* rawImage)
Expand All @@ -118,7 +119,7 @@ int arm::app::CameraCaptureStart(uint8_t* rawImage)

/* NOTE: This is a blocking call at the moment; doesn't need to be.
* It slows down the whole pipeline considerably. */
Driver_CAMERA0.CaptureFrame(rawImage);
Driver_CPI.CaptureFrame(rawImage);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions device/alif-ensemble/src/GpioSignal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "log_macros.h"

#include <inttypes.h>
#include "gpio.h"

namespace arm {
namespace app {
Expand Down
4 changes: 2 additions & 2 deletions device/alif-ensemble/src/LcdDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ static void cdc_event_handler(uint32_t event)
static void clear_display_error(void)
{
/* Clear the error. */
NVIC_DisableIRQ((IRQn_Type)MIPI_DSI_IRQ);
NVIC_DisableIRQ((IRQn_Type)DSI_IRQ_IRQn);
s_display_error = false;
NVIC_EnableIRQ((IRQn_Type)MIPI_DSI_IRQ);
NVIC_EnableIRQ((IRQn_Type)DSI_IRQ_IRQn);
}

#if defined(__cplusplus)
Expand Down
Loading