Skip to content

Commit 627898f

Browse files
committed
fix mega100 vet6
1 parent 46598f0 commit 627898f

16 files changed

Lines changed: 755 additions & 181 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

.devcontainer/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# syntax=docker/dockerfile:1
22
# base image from ggrouv: https://github.com/ggurov/rusefibuildcontainer
33
FROM ubuntu:mantic
4-
RUN sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list && \
4+
RUN sed -i \
5+
-e 's|http://ports.ubuntu.com/ubuntu-ports|http://old-releases.ubuntu.com/ubuntu|g' \
6+
-e 's|http://archive.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' \
7+
-e 's|http://security.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' \
8+
/etc/apt/sources.list && \
59
apt-get update
610
RUN apt-get -y install make automake autoconf gcc-12-arm-linux-gnueabi gcc-12-arm-linux-gnueabi-base gcc-arm-none-eabi binutils-arm-none-eabi git nano openjdk-21-jdk-headless mtools dosfstools xxd
711
RUN apt-get -y install openssh-server cmake rsync gdb-multiarch build-essential zip p7zip-full bc

.github/workflows/build-firmware.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Nightly Release
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *' # 2 AM UTC daily
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Release tag (default: today YYYY-MM-DD)'
10+
required: false
11+
12+
jobs:
13+
generate-matrix:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
matrix: ${{ steps.set-matrix.outputs.matrix }}
17+
tag: ${{ steps.set-tag.outputs.tag }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: true
22+
23+
- name: Set matrix
24+
id: set-matrix
25+
run: |
26+
export EVENT_NAME="${{ github.event_name }}"
27+
export RUN_ATTEMPT="${{ github.run_attempt }}"
28+
export COMMIT_MESSAGE=""
29+
echo "matrix=$(bash ext/rusefi/firmware/bin/generate_matrix.sh boards)" >> $GITHUB_OUTPUT
30+
31+
- name: Set release tag
32+
id: set-tag
33+
run: |
34+
if [ -n "${{ github.event.inputs.tag }}" ]; then
35+
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
36+
else
37+
echo "tag=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
38+
fi
39+
40+
build:
41+
needs: generate-matrix
42+
runs-on: ubuntu-latest
43+
if: ${{ ! contains(needs.generate-matrix.outputs.matrix, '[]') }}
44+
strategy:
45+
fail-fast: false
46+
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
submodules: true
52+
53+
- uses: ./ext/rusefi/.github/workflows/custom-board-build
54+
with:
55+
meta_info: ${{ matrix.meta-info }}
56+
push: 'false'
57+
run_simulator: 'false'
58+
artifacts: bin srec hex
59+
uploads: ''
60+
MY_REPO_PAT: ${{ secrets.MY_REPO_PAT }}
61+
ADDITIONAL_ENV: ${{ secrets.ADDITIONAL_ENV }}
62+
63+
release:
64+
needs: [generate-matrix, build]
65+
runs-on: ubuntu-latest
66+
permissions:
67+
contents: write
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Download all firmware artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
path: release-assets/
75+
merge-multiple: true
76+
77+
- name: List release assets
78+
run: find release-assets/ -type f | sort
79+
80+
- name: Read changelog
81+
id: changelog
82+
run: |
83+
if [ -f CHANGELOG.md ]; then
84+
# Extract the latest release section
85+
BODY=$(awk '/^## \[/{p++} p==1{print} p==2{exit}' CHANGELOG.md | tail -n +2)
86+
echo "body<<CHANGELOG_EOF" >> $GITHUB_OUTPUT
87+
echo "$BODY" >> $GITHUB_OUTPUT
88+
echo "CHANGELOG_EOF" >> $GITHUB_OUTPUT
89+
else
90+
echo "body=Automated nightly firmware build." >> $GITHUB_OUTPUT
91+
fi
92+
93+
- name: Create GitHub Release
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
tag_name: ${{ needs.generate-matrix.outputs.tag }}
97+
name: Nightly ${{ needs.generate-matrix.outputs.tag }}
98+
prerelease: true
99+
body: |
100+
Automated nightly firmware build for Mazduino boards.
101+
102+
${{ steps.changelog.outputs.body }}
103+
104+
## Boards included
105+
- mazduino-compact (STM32F407VGT6, knock enabled)
106+
- mazduino-lite (STM32F407VGT6, no knock)
107+
- mazduino-mini6ch (STM32F427VGT6, ETB + traction control)
108+
- mazduino-mega100 (STM32F407VGT6, 1MB, full features, USB + CAN)
109+
- mazduino-mega100-512 (STM32F407VET6, 512KB, reduced feature set)
110+
111+
## Files
112+
- `.bin` - raw firmware binary (flash via ST-Link or DFU)
113+
- `.srec` - firmware with CRC checksum (flash via OpenBLT bootloader)
114+
- `.hex` - Intel HEX format
115+
116+
## TunerStudio Connection
117+
Connect via USB virtual COM port (all boards except mega100 variants which use CAN bus).
118+
files: release-assets/*

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changelog
2+
3+
All notable changes to Mazduino firmware are documented here.
4+
5+
## [Unreleased]
6+
7+
### Added
8+
- mazduino-mega100: STM32F407VGT6 (1MB) board with full feature set, dual pinout support (board04 and UA4C) selectable via TunerStudio board action
9+
- mazduino-mega100-512: STM32F407VET6 (512KB) board with reduced feature set; firmware constrained to 384KB to keep tune storage sector (sector 7, 0x08060000) free
10+
- Nightly release workflow publishing per-board .bin, .srec, and .hex artifacts as GitHub Releases
11+
- Docker-based build system (`build_boards.sh`) using `--platform linux/amd64` for consistent builds on Apple Silicon and x86-64
12+
- TunerStudio UI flags in `prepend.txt` to hide ETB, traction control, boost, rotary, Harley-Davidson, torque model, and other features not applicable to each board variant
13+
14+
### Changed
15+
- mazduino-mega100 and mega100-512: status LED at PB7 enabled (`getCommsLedPin()` and `LED_CRITICAL_ERROR_BRAIN_PIN` both assigned to PB7)
16+
- mazduino-compact: second idle solenoid field corrected to `secondSolenoidPin`
17+
- mazduino-lite: knock disabled by leaving `EFI_SOFTWARE_KNOCK` undefined (not set to FALSE) so `#ifdef` guards evaluate correctly
18+
- mazduino-mini6ch: `ts_show_traction_control true` enabled as ETB-capable board is the only variant that supports traction control
19+
- Dockerfile updated to handle both `ports.ubuntu.com` (ARM64) and `archive.ubuntu.com` (x86-64) Ubuntu mirror replacements for EOL Mantic release
20+
21+
### Fixed
22+
- Root `board_configuration.cpp`: removed forward declaration of `customBoardTsAction` which caused undefined reference linker error in CI unit test build
23+
- `EFI_EMBED_INI_MSD=FALSE` on mega100-512: the embedded TunerStudio INI file was contributing approximately 155KB to the firmware binary; disabling it reduced firmware from 488KB to 271KB
24+
25+
## [2025-01-01]
26+
27+
### Added
28+
- Initial multi-board support: mazduino-compact, mazduino-lite, mazduino-mini6ch
29+
- Hardware knock detection on compact via ADC3/PA3
30+
- Per-board `prepend.txt` for TunerStudio UI customization
31+
- GitHub Actions matrix build (`build-matrix.yaml`) scanning `boards/` directory automatically
32+
- Unit test build (`unit-tests.yaml`)
33+
- rusEFI submodule reference tracking (`update-rusefi-reference.yaml`)
34+
35+
### Changed
36+
- Engine displacement updated to 1.8L default
37+
- Knock ADC channel updated to ADC3/PA3 for improved signal isolation

boards/mazduino-mega100-512/board.mk

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ endif
77
DDEFS += -DEFI_WIDEBAND_FIRMWARE_UPDATE=FALSE
88
DDEFS += -DRAM_UNUSED_SIZE=100
99

10-
# STM32F407VET6: 512KB flash
10+
# STM32F407VET6: 512KB total flash, but tune occupies sector 7 (0x08060000-0x0807FFFF).
11+
# Code region is limited to sectors 0-6 (384KB) to leave sector 7 free for tune storage.
12+
# The linker will error with "overflow" if code exceeds 384KB.
1113
DDEFS += -DMIN_FLASH_SIZE=512
12-
USE_OPT += -Wl,--defsym=EFI_FLASH_SIZE=512k
14+
USE_OPT += -Wl,--defsym=EFI_FLASH_SIZE=384k
1315

14-
# Assign critical LED to a non-existent pin (board has no LEDs)
15-
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::I15
16+
# Status LED at PB7
17+
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B7
1618

17-
# EFI_USB_SERIAL=FALSE, EFI_LUA=FALSE, EFI_ELECTRONIC_THROTTLE_BODY=FALSE set in efifeatures.h
18-
# HAL_USE_USB derives FALSE automatically from EFI_USB_SERIAL
19+
# EFI_LUA=FALSE, EFI_ELECTRONIC_THROTTLE_BODY=FALSE set in efifeatures.h
20+
# EFI_USB_SERIAL=TRUE (default) — USB virtual COM port enabled for TunerStudio
1921

2022
# Disable SD card/FAT to save flash
2123
DDEFS += -DEFI_FILE_LOGGING=FALSE

boards/mazduino-mega100-512/board_configuration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
*
77
* Uses board_04 pinout (INJ: B15/B14/B12/B13, IGN: E2/E3/C13/E7).
88
* Runtime pinout switching disabled to reduce flash usage.
9-
* No USB, no SD card, no Lua (EFI_LUA=FALSE in board.mk).
9+
* No SD card, no Lua (EFI_LUA=FALSE in board.mk). USB enabled for TunerStudio.
1010
*/
1111

1212
#include "pch.h"
1313
#include "board_overrides.h"
1414

15-
Gpio getCommsLedPin() { return Gpio::Unassigned; }
15+
Gpio getCommsLedPin() { return Gpio::B7; }
1616
Gpio getRunningLedPin() { return Gpio::Unassigned; }
1717
Gpio getWarningLedPin() { return Gpio::Unassigned; }
1818

Lines changed: 104 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,124 @@
11
/**
22
* @file efifeatures.h
33
* Mazduino Mega100-512 (STM32F407VET6 - 512KB flash)
4-
* Feature overrides to fit in 512KB flash.
4+
*
5+
* Firmware code MUST stay below 384KB (0x08060000) because rusefi stores the
6+
* tune in sector 7 (0x08060000-0x0807FFFF, 128KB) — erasing it for a tune
7+
* write would brick the ECU if code occupies that sector.
58
*/
69

710
#pragma once
811

912
#include "../../ext/rusefi/firmware/config/stm32f4ems/efifeatures.h"
1013

11-
/* No USB */
12-
#undef EFI_USB_SERIAL
13-
#define EFI_USB_SERIAL FALSE
14-
1514
/* No Lua */
1615
#undef EFI_LUA
1716
#define EFI_LUA FALSE
1817

19-
/* No SD card storage */
18+
/* No SD card */
2019
#undef EFI_STORAGE_SD
2120
#define EFI_STORAGE_SD FALSE
2221

23-
/* No Electronic Throttle Body */
22+
/* No ETB */
2423
#undef EFI_ELECTRONIC_THROTTLE_BODY
2524
#define EFI_ELECTRONIC_THROTTLE_BODY FALSE
2625

27-
/* No software knock (saves ~50KB flash) - leave undefined so #ifdef checks are FALSE */
26+
/* No software knock leave undefined so #ifdef EFI_SOFTWARE_KNOCK is FALSE */
2827
#undef EFI_SOFTWARE_KNOCK
28+
29+
/* Debug/analysis tools — not needed in production firmware */
30+
#undef EFI_TOOTH_LOGGER
31+
#define EFI_TOOTH_LOGGER FALSE
32+
33+
#undef EFI_LOGIC_ANALYZER
34+
#define EFI_LOGIC_ANALYZER FALSE
35+
36+
/* Anti-lag and HPFP (GDI) not applicable to Mazda OEM hardware */
37+
#undef EFI_ANTILAG_SYSTEM
38+
#define EFI_ANTILAG_SYSTEM FALSE
39+
40+
#undef EFI_HPFP
41+
#define EFI_HPFP FALSE
42+
43+
/* CAN GPIO bridging not used */
44+
#undef EFI_CAN_GPIO
45+
#define EFI_CAN_GPIO FALSE
46+
47+
/* Verbose TS output not needed */
48+
#undef EFI_TUNER_STUDIO_VERBOSE
49+
#define EFI_TUNER_STUDIO_VERBOSE FALSE
50+
51+
/* Bluetooth setup not used */
52+
#undef EFI_BLUETOOTH_SETUP
53+
#define EFI_BLUETOOTH_SETUP FALSE
54+
55+
/* Dyno view — nice-to-have but saves code space */
56+
#undef EFI_DYNO_VIEW
57+
#define EFI_DYNO_VIEW FALSE
58+
59+
/* Engine position emulation — debug/bench testing only */
60+
#undef EFI_ENGINE_EMULATOR
61+
#define EFI_ENGINE_EMULATOR FALSE
62+
63+
#undef EFI_EMULATE_POSITION_SENSORS
64+
#define EFI_EMULATE_POSITION_SENSORS FALSE
65+
66+
/* Text console logging — no USB, no UART console exposed on board */
67+
#undef EFI_TEXT_LOGGING
68+
#define EFI_TEXT_LOGGING FALSE
69+
70+
/* CLI support — no console connection on production unit */
71+
#undef EFI_CLI_SUPPORT
72+
#define EFI_CLI_SUPPORT FALSE
73+
74+
/* Alternator control — not commonly required */
75+
#undef EFI_ALTERNATOR_CONTROL
76+
#define EFI_ALTERNATOR_CONTROL FALSE
77+
78+
/* CIC-style idle PID — standard PID still works without it */
79+
#undef EFI_IDLE_PID_CIC
80+
#define EFI_IDLE_PID_CIC FALSE
81+
82+
/* TS scatter gather — saves protocol overhead code */
83+
#undef EFI_TS_SCATTER
84+
#define EFI_TS_SCATTER FALSE
85+
86+
/* Launch control — omitted on 512KB budget variant */
87+
#undef EFI_LAUNCH_CONTROL
88+
#define EFI_LAUNCH_CONTROL FALSE
89+
90+
/* VVT PID closed-loop — omitted on 512KB budget variant */
91+
#undef EFI_VVT_PID
92+
#define EFI_VVT_PID FALSE
93+
94+
/* Vehicle speed sensor support */
95+
#undef EFI_VEHICLE_SPEED
96+
#define EFI_VEHICLE_SPEED FALSE
97+
98+
/* RTC support */
99+
#undef EFI_RTC
100+
#define EFI_RTC FALSE
101+
102+
/* Main relay control via MCU pin — not wired on this board */
103+
#undef EFI_MAIN_RELAY_CONTROL
104+
#define EFI_MAIN_RELAY_CONTROL FALSE
105+
106+
/* Boost control — omitted on 512KB budget variant */
107+
#undef EFI_BOOST_CONTROL
108+
#define EFI_BOOST_CONTROL FALSE
109+
110+
/* Engine sniffer (real-time trigger oscilloscope) — debug tool */
111+
#undef EFI_ENGINE_SNIFFER
112+
#define EFI_ENGINE_SNIFFER FALSE
113+
114+
/* Embedded INI MSD (USB mass storage) — USB is disabled, no point embedding */
115+
#undef EFI_EMBED_INI_MSD
116+
#define EFI_EMBED_INI_MSD FALSE
117+
118+
/* Lua lookup tables — Lua is disabled, LTO strips these but explicitly disable */
119+
#undef EFI_LUA_LOOKUP
120+
#define EFI_LUA_LOOKUP FALSE
121+
122+
/* Clock lock assertions — debug aid */
123+
#undef EFI_CLOCK_LOCKS
124+
#define EFI_CLOCK_LOCKS FALSE

0 commit comments

Comments
 (0)