Skip to content

Commit 8ba685e

Browse files
authored
Merge pull request #23 from xboxoneresearch/task/stm32_firmware
Add stm32 firmware
2 parents 108e198 + 44ee157 commit 8ba685e

1,204 files changed

Lines changed: 648716 additions & 617 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_pcbs.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ name: Build PCBs
33
on:
44
workflow_call:
55
push:
6-
# paths:
7-
# - "*.kicad_sch"
8-
# - "*.kicad_pcb"
9-
# - "*.kicad_pro"
10-
# - "kibot.yml"
6+
paths:
7+
- "*.kicad_sch"
8+
- "*.kicad_pcb"
9+
- "*.kicad_pro"
10+
- "kibot.yml"
1111
pull_request:
12-
# paths:
13-
# - "*.kicad_sch"
14-
# - "*.kicad_pcb"
15-
# - "*.kicad_pro"
16-
# - "kibot.yml"
12+
paths:
13+
- "*.kicad_sch"
14+
- "*.kicad_pcb"
15+
- "*.kicad_pro"
16+
- "kibot.yml"
1717

1818
jobs:
19-
build:
19+
build_pcb:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
with:
2424
fetch-depth: 0
2525
- uses: INTI-CMNB/KiBot@v2_k9
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: STM32 Build
2+
3+
on:
4+
workflow_call:
5+
push:
6+
paths:
7+
- "firmware/**"
8+
pull_request:
9+
paths:
10+
- "firmware/**"
11+
12+
env:
13+
TOOLCHAIN_URL: https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz
14+
15+
jobs:
16+
build_stm32_fw:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v5
22+
23+
- name: Install ARM GCC Toolchain
24+
run: |
25+
cd /tmp
26+
wget -q -O arm-gnu-toolchain.tar.xz ${{ env.TOOLCHAIN_URL }}
27+
tar -xf arm-gnu-toolchain.tar.xz
28+
sudo mv arm-gnu-toolchain-* /opt/gcc-arm-none-eabi
29+
echo "/opt/gcc-arm-none-eabi/bin" >> $GITHUB_PATH
30+
31+
- name: Verify ARM GCC installation
32+
run: |
33+
arm-none-eabi-gcc --version
34+
arm-none-eabi-objcopy --version
35+
36+
- name: Build
37+
working-directory: firmware
38+
run: make
39+
40+
- name: Upload build artifacts
41+
uses: actions/upload-artifact@v4
42+
if: success()
43+
with:
44+
name: aspect2-stm32-firmware-${{ github.sha }}
45+
path: |
46+
firmware/build/*.bin
47+
firmware/build/*.elf
48+
firmware/build/*.hex
49+
retention-days: 30

.github/workflows/release.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- "v*.*"
88

99
permissions:
10-
contents: read
10+
contents: write
1111
pages: write
1212
id-token: write
1313

@@ -16,22 +16,29 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19-
build_pcb:
19+
pcb:
2020
uses: xboxoneresearch/ASPECT2-PCB/.github/workflows/build_pcbs.yml@main
2121

22+
firmware:
23+
uses: xboxoneresearch/ASPECT2-PCB/.github/workflows/build_stm32_fw.yml@main
24+
2225
release:
2326
runs-on: ubuntu-latest
24-
needs: [build_pcb]
27+
needs: [pcb,firmware]
2528
if: success()
2629
environment:
2730
name: github-pages
2831
url: ${{ steps.release.outputs.page_url }}
2932
steps:
3033
- name: Download artifacts
31-
uses: actions/download-artifact@v4
32-
- name: Release
34+
uses: actions/download-artifact@v5
35+
- name: Zip up release artifact
36+
run: 7z a aspect2-pcb-${{ github.ref_name }}.7z *
37+
- name: Create release
3338
if: startsWith(github.ref, 'refs/tags/')
3439
uses: softprops/action-gh-release@v2
40+
with:
41+
files: aspect2-pcb-*.7z
3542

3643
- uses: actions/upload-pages-artifact@v3
3744
with:

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build PCBs](https://github.com/xboxoneresearch/ASPECT2-PCB/actions/workflows/build_pcbs.yml/badge.svg)](https://github.com/xboxoneresearch/ASPECT2-PCB/actions/workflows/build_pcbs.yml)
2+
[![Build firmware](https://github.com/xboxoneresearch/ASPECT2-PCB/actions/workflows/build_stm32_fw.yml/badge.svg)](https://github.com/xboxoneresearch/ASPECT2-PCB/actions/workflows/build_stm32_fw.yml)
23

34
# ASPECT2 PCB
45

@@ -10,7 +11,8 @@
1011
This repo contains:
1112

1213
* KiCad files for the PCB / schematics
13-
* EEPROM template for FT_PROG
14+
* [EEPROM template](./eeprom/) for FT_PROG
15+
* [STM32 firmware](./firmware/)
1416

1517
## Directory structure
1618

@@ -19,6 +21,7 @@ This repo contains:
1921
├── eeprom
2022
│ ├── Greybull_FabD+.xml - FT Prog template (official on-board FACET)
2123
│ └── Facet2_fabA+.xml - FT Prog template (derived from onboard FTDI dump)
24+
├── firmware - STM32 firmware
2225
├── lib - additional KiCad symbols / footprints
2326
└── references - Datasheets and original blurry PCB photos
2427
```
@@ -51,8 +54,13 @@ Before being able to communicate with the device, programming eeprom or regular
5154
* Click Close-button, close FT Prog tool
5255
* Re-plug Aspect2 board
5356

57+
## Programming the STM32 (POST Code display)
58+
59+
See [firmware/](./firmware/) for build & flash instructions.
60+
5461
## References
5562

5663
- [AssemblerGames](https://web.archive.org/web/20250327165519/https://assemblergames.org/viewtopic.php?p=870129) - first mentioning of FACET2 PCB
5764
- [FACET on xosft wiki](https://xboxoneresearch.github.io/wiki/hardware/facet/) - Technical documentation of FACET port
65+
- [POST code on xosft wiki](https://xboxoneresearch.github.io/wiki/hardware/post/) - Original MAX6958A circuit and error codes
5866
- [libaspect2](https://github.com/xboxoneresearch/libaspect2) - Attempt at an open source library

assets/pcb_work_in_progress.png

-202 KB
Binary file not shown.

firmware/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
.vscode/
3+
.stm32env
4+
.mxproject

firmware/Core/Inc/display.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef __DISPLAY_H
2+
#define __DISPLAY_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include <ssd1306.h>
9+
#include <ssd1306_fonts.h>
10+
#include "ssd1306_conf.h"
11+
#include "main.h"
12+
13+
void Display_Init(void);
14+
void Display_Print(char *message);
15+
void Display_Tick(void);
16+
17+
#ifdef __cplusplus
18+
}
19+
#endif
20+
21+
#endif

firmware/Core/Inc/main.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file : main.h
5+
* @brief : Header for main.c file.
6+
* This file contains the common defines of the application.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
/* USER CODE END Header */
20+
21+
/* Define to prevent recursive inclusion -------------------------------------*/
22+
#ifndef __MAIN_H
23+
#define __MAIN_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/* Includes ------------------------------------------------------------------*/
30+
#include "stm32g0xx_hal.h"
31+
32+
/* Private includes ----------------------------------------------------------*/
33+
/* USER CODE BEGIN Includes */
34+
#include <string.h>
35+
#include <stdio.h>
36+
#include <stdint.h>
37+
/* USER CODE END Includes */
38+
39+
/* Exported types ------------------------------------------------------------*/
40+
/* USER CODE BEGIN ET */
41+
42+
/* USER CODE END ET */
43+
44+
/* Exported constants --------------------------------------------------------*/
45+
/* USER CODE BEGIN EC */
46+
47+
/* USER CODE END EC */
48+
49+
/* Exported macro ------------------------------------------------------------*/
50+
/* USER CODE BEGIN EM */
51+
52+
/* USER CODE END EM */
53+
54+
/* Exported functions prototypes ---------------------------------------------*/
55+
void Error_Handler(void);
56+
57+
/* USER CODE BEGIN EFP */
58+
59+
/* USER CODE END EFP */
60+
61+
/* Private defines -----------------------------------------------------------*/
62+
63+
/* USER CODE BEGIN Private defines */
64+
65+
/* USER CODE END Private defines */
66+
67+
#ifdef __cplusplus
68+
}
69+
#endif
70+
71+
#endif /* __MAIN_H */

firmware/Core/Inc/slave.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef _SLAVE_H
2+
#define _SLAVE_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include "main.h"
9+
10+
#define REG_MAP_SIZE 0x25
11+
12+
void Slave_Init(void);
13+
14+
/* Example accessors */
15+
uint8_t slave_reg_read(uint8_t addr);
16+
void slave_reg_write(uint8_t addr, uint8_t val);
17+
18+
uint8_t slave_is_new_segment_available(void);
19+
uint8_t slave_hard_error(void);
20+
21+
#ifdef __cplusplus
22+
}
23+
#endif
24+
25+
#endif

firmware/Core/Inc/ssd1306_conf.h

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Private configuration file for the SSD1306 library.
3+
* This example is configured for STM32F0, I2C and including all fonts.
4+
*/
5+
6+
#ifndef _SSD1306_CONF_H
7+
#define _SSD1306_CONF_H
8+
9+
// Choose a microcontroller family
10+
//#define STM32F0
11+
//#define STM32F1
12+
//#define STM32F4
13+
//#define STM32L0
14+
//#define STM32L1
15+
//#define STM32L4
16+
//#define STM32F3
17+
//#define STM32H7
18+
//#define STM32F7
19+
#define STM32G0
20+
//#define STM32C0
21+
//#define STM32U5
22+
23+
// Choose a bus
24+
#define SSD1306_USE_I2C
25+
//#define SSD1306_USE_SPI
26+
27+
// I2C Configuration
28+
#define SSD1306_I2C_PORT hi2c2
29+
#define SSD1306_I2C_ADDR (0x3C << 1)
30+
31+
// SPI Configuration
32+
//#define SSD1306_SPI_PORT hspi1
33+
//#define SSD1306_CS_Port OLED_CS_GPIO_Port
34+
//#define SSD1306_CS_Pin OLED_CS_Pin
35+
//#define SSD1306_DC_Port OLED_DC_GPIO_Port
36+
//#define SSD1306_DC_Pin OLED_DC_Pin
37+
//#define SSD1306_Reset_Port OLED_Res_GPIO_Port
38+
//#define SSD1306_Reset_Pin OLED_Res_Pin
39+
40+
// Mirror the screen if needed
41+
#define SSD1306_MIRROR_VERT
42+
#define SSD1306_MIRROR_HORIZ
43+
44+
// Set inverse color if needed
45+
// # define SSD1306_INVERSE_COLOR
46+
47+
// Include only needed fonts
48+
#define SSD1306_INCLUDE_FONT_6x8
49+
#define SSD1306_INCLUDE_FONT_7x10
50+
#define SSD1306_INCLUDE_FONT_11x18
51+
#define SSD1306_INCLUDE_FONT_16x26
52+
53+
#define SSD1306_INCLUDE_FONT_16x24
54+
55+
#define SSD1306_INCLUDE_FONT_16x15
56+
57+
// The width of the screen can be set using this
58+
// define. The default value is 128.
59+
#define SSD1306_WIDTH 128
60+
61+
// If your screen horizontal axis does not start
62+
// in column 0 you can use this define to
63+
// adjust the horizontal offset
64+
// #define SSD1306_X_OFFSET
65+
66+
// The height can be changed as well if necessary.
67+
// It can be 32, 64 or 128. The default value is 64.
68+
#define SSD1306_HEIGHT 32
69+
70+
#endif

0 commit comments

Comments
 (0)