Skip to content

Commit

Permalink
Add initial pack contents
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigaMahne authored and DavidLesnjak committed Sep 19, 2024
1 parent 6400799 commit 015f2fd
Show file tree
Hide file tree
Showing 9 changed files with 575 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build pack
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pack:
name: Generate pack
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch tags
if: github.event_name == 'release'
run: |
git fetch --tags --force
- uses: Open-CMSIS-Pack/gen-pack-action@main
with:
doxygen-version: none
packchk-version: 1.4.1
gen-pack-script: ./gen_pack.sh
gen-pack-output: ./output
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Pack build files
/build/
/output/
233 changes: 233 additions & 0 deletions CMSIS/Driver/vio_STM32H745I-DISCO.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
/******************************************************************************
* @file vio_STM32H745I-DISCO.c
* @brief Virtual I/O implementation for board STM32H745I-DISCO
* @version V2.0.0
* @date 4. September 2024
******************************************************************************/
/*
* Copyright (c) 2021-2024 Arm Limited (or its affiliates).
* All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*! \page vio_STM32H745I-DISCO Physical I/O Mapping
The table below lists the physical I/O mapping of this CMSIS-Driver VIO implementation.
Virtual Resource | Variable | Physical Resource on STM32H745I-DISCO |
:-----------------|:---------------|:------------------------------------------|
vioBUTTON0 | vioSignalIn.0 | PC13: Button USER |
vioLED0 | vioSignalOut.0 | PJ2: LD6 RED |
vioLED1 | vioSignalOut.1 | PI13: LD7 GREEN |
*/

#include "cmsis_vio.h"

#include "RTE_Components.h" // Component selection
#include CMSIS_device_header

#if !defined CMSIS_VOUT || !defined CMSIS_VIN
#include "GPIO_STM32.h"
#endif

// VIO input, output definitions
#ifndef VIO_VALUE_NUM
#define VIO_VALUE_NUM 5U // Number of values
#endif

// VIO input, output variables
static uint32_t vioSignalIn __USED; // Memory for incoming signal
static uint32_t vioSignalOut __USED; // Memory for outgoing signal
static int32_t vioValue[VIO_VALUE_NUM] __USED; // Memory for value used in vioGetValue/vioSetValue

#if !defined CMSIS_VOUT || !defined CMSIS_VIN

// VIO Active State
#define VIO_ACTIVE_LOW 0U
#define VIO_ACTIVE_HIGH 1U

typedef struct {
uint32_t vioSignal;
uint16_t pin;
uint8_t pullResistor;
uint8_t activeState;
} pinCfg_t;

#if !defined CMSIS_VOUT
// VOUT Configuration
static const pinCfg_t outputCfg[] = {
// signal, pin, pull resistor, active state
{ vioLED0, GPIO_PIN_ID_PORTJ(2), ARM_GPIO_PULL_NONE, VIO_ACTIVE_LOW },
{ vioLED1, GPIO_PIN_ID_PORTI(13), ARM_GPIO_PULL_NONE, VIO_ACTIVE_LOW }
};
#endif

#if !defined CMSIS_VIN
// VIN Configuration
static const pinCfg_t inputCfg[] = {
// signal, pin, pull resistor, active state
{ vioBUTTON0, GPIO_PIN_ID_PORTC(13), ARM_GPIO_PULL_NONE, VIO_ACTIVE_HIGH }
};
#endif

// External GPIO Driver
extern ARM_DRIVER_GPIO Driver_GPIO0;
static ARM_DRIVER_GPIO *pGPIODrv = &Driver_GPIO0;
#endif

// Initialize test input, output.
void vioInit (void) {
uint32_t n;
#if !defined(CMSIS_VOUT) || !defined(CMSIS_VIN)
ARM_GPIO_Pin_t pin;
#endif

vioSignalIn = 0U;
vioSignalOut = 0U;

for (n = 0U; n < VIO_VALUE_NUM; n++) {
vioValue[n] = 0U;
}

#if !defined CMSIS_VOUT
for (n = 0U; n < (sizeof(outputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)outputCfg[n].pin;
pGPIODrv->Setup(pin, NULL);
pGPIODrv->SetOutputMode(pin, ARM_GPIO_PUSH_PULL);
pGPIODrv->SetPullResistor(pin, outputCfg[n].pullResistor);
pGPIODrv->SetDirection(pin, ARM_GPIO_OUTPUT);

// Set initial pin state to inactive
if (outputCfg[n].activeState == VIO_ACTIVE_HIGH) {
pGPIODrv->SetOutput(pin, 0U);
} else {
pGPIODrv->SetOutput(pin, 1U);
}
}
#endif

#if !defined CMSIS_VIN
for (n = 0U; n < (sizeof(inputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)inputCfg[n].pin;
pGPIODrv->Setup(pin, NULL);
pGPIODrv->SetPullResistor(pin, inputCfg[n].pullResistor);
pGPIODrv->SetDirection(pin, ARM_GPIO_INPUT);
}
#endif
}

// Set signal output.
void vioSetSignal (uint32_t mask, uint32_t signal) {
#if !defined CMSIS_VOUT
ARM_GPIO_Pin_t pin;
uint32_t pinValue, n;
#endif

vioSignalOut &= ~mask;
vioSignalOut |= mask & signal;

#if !defined CMSIS_VOUT
// Output signals to LEDs
for (n = 0U; n < (sizeof(outputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)outputCfg[n].pin;
if ((mask & outputCfg[n].vioSignal) != 0U) {
if ((signal & outputCfg[n].vioSignal) != 0U) {
pinValue = 1U;
} else {
pinValue = 0U;
}
if (pinValue == outputCfg[n].activeState) {
pGPIODrv->SetOutput(pin, 1U);
} else {
pGPIODrv->SetOutput(pin, 0U);
}
}
}
#endif
}

// Get signal input.
uint32_t vioGetSignal (uint32_t mask) {
uint32_t signal;
#if !defined CMSIS_VIN
ARM_GPIO_Pin_t pin;
uint32_t pinValue, n;
#endif

#if !defined CMSIS_VIN
// Get input signals from buttons
for (n = 0U; n < (sizeof(inputCfg) / sizeof(pinCfg_t)); n++) {
pin = (ARM_GPIO_Pin_t)inputCfg[n].pin;
if ((mask & inputCfg[n].vioSignal) != 0U) {
pinValue = pGPIODrv->GetInput(pin);
if (pinValue == inputCfg[n].activeState) {
vioSignalIn |= inputCfg[n].vioSignal;
} else {
vioSignalIn &= ~inputCfg[n].vioSignal;
}
}
}
#endif

signal = vioSignalIn & mask;

return signal;
}

// Set value output.
// Note: vioAOUT not supported.
void vioSetValue (uint32_t id, int32_t value) {
uint32_t index = id;
#if !defined CMSIS_VOUT
// Add user variables here:

#endif

if (index >= VIO_VALUE_NUM) {
return; /* return in case of out-of-range index */
}

vioValue[index] = value;

#if !defined CMSIS_VOUT
// Add user code here:

#endif
}

// Get value input.
// Note: vioAIN not supported.
int32_t vioGetValue (uint32_t id) {
uint32_t index = id;
int32_t value;
#if !defined CMSIS_VIN
// Add user variables here:

#endif

if (index >= VIO_VALUE_NUM) {
return 0U; /* return 0 in case of out-of-range index */
}

#if !defined CMSIS_VIN
// Add user code here:

#endif

value = vioValue[index];

return value;
}
32 changes: 32 additions & 0 deletions Documents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Overview

The STM32H745I-DISCO Discovery kit is a complete demonstration and development platform for Arm® Cortex®-M7 and Arm® Cortex®-M4 core-based STM32H745XI microcontroller, with 2 Mbyte of flash memory and 1 Mbyte of SRAM.

The STM32H745I-DISCO Discovery kit is used as a reference design for user application development before porting to the final product, thus simplifying the application development.

The full range of hardware features available on the board helps users to enhance their application development by an evaluation of all the peripherals (such as USB OTG FS, Ethernet, USART, CAN FD, SAI audio DAC stereo with audio jack input and output, MEMS digital microphone, RGB interface LCD with capacitive touch panel, and others). ARDUINO® Uno V3, STMod+ connectors provide easy connection to extension shields or daughterboards for specific applications.

STLINK-V3E is integrated into the board, as the embedded in-circuit debugger and programmer for the STM32 MCU and USB Virtual COM port bridge.

# Getting started

- [User manual](https://www.st.com/resource/en/user_manual/um2488-discovery-kits-with-stm32h745xi-and-stm32h750xb-mcus-stmicroelectronics.pdf)

## ST-LINK driver installation and firmware upgrade (on Microsoft Windows)

1. Download the latest [ST-LINK driver](https://www.st.com/en/development-tools/stsw-link009.html).
2. Extract the archive and run `dpinst_amd64.exe`. Follow the displayed instructions.
3. Download the latest [ST-LINK firmware upgrade](https://www.st.com/en/development-tools/stsw-link007.html).
4. Extract the archive and run the `ST-LinkUpgrade.exe` program.
5. Connect the board to your PC using a USB cable and wait until the USB enumeration is completed.
6. In the **ST-Link Upgrade** program, press the **Device Connect** button.
7. When the ST-LINK driver is correctly installed, the current ST-LINK version is displayed.
8. Press the **Yes >>>>** button to start the firmware upgrade process.

# Technical reference

- [STM32H745XI microcontroller](https://www.st.com/en/microcontrollers-microprocessors/stm32h745xi.html)
- [STM32H745I-DISCO board](https://www.st.com/en/evaluation-tools/stm32h745i-disco.html)
- [User manual](https://www.st.com/resource/en/user_manual/um2488-discovery-kits-with-stm32h745xi-and-stm32h750xb-mcus-stmicroelectronics.pdf)
- [Data brief](https://www.st.com/resource/en/data_brief/stm32h745i-disco.pdf)
- [Schematic](https://www.st.com/resource/en/schematic_pack/mb1381-h745xi-b01-schematic.pdf)
Binary file added Images/stm32h745i-disco_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/stm32h745i-disco_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 015f2fd

Please sign in to comment.