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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
.DS_Store
*.hex

.vscode/settings.json

LCM/Project/MDK5/Objects/
LCM/Project/MDK5/LCM_Light_Control_IO_WS2812_New.uvguix.*
LCM/Project/MDK5/Listings/

LCM/Project/MDK5/out/
LCM/Project/MDK5/tmp/

LCM/Project/MDK5/.clangd
LCM/Project/MDK5/LCM_Light_Control_IO_WS2812_New.cbuild-idx.yml
LCM/Project/MDK5/LCM_Light_Control_IO_WS2812_New.cbuild-set.yml
LCM/Project/MDK5/LCM_Light_Control_IO_WS2812_New*.cbuild.yml
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["arm.keil-studio-pack"]
}
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Arm Debugger",
"type": "arm-debugger",
"request": "launch",
"serialNumber": "${command:device-manager.getSerialNumber}",
"programs": "${command:cmsis-csolution.getBinaryFiles}",
"cmsisPack": "${command:cmsis-csolution.getTargetPack}",
"deviceName": "${command:cmsis-csolution.getDeviceName}",
"processorName": "${command:cmsis-csolution.getProcessorName}"
}
]
}
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "arm-debugger.flash",
"serialNumber": "${command:device-manager.getSerialNumber}",
"programs": "${command:cmsis-csolution.getBinaryFiles}",
"cmsisPack": "${command:cmsis-csolution.getTargetPack}",
"deviceName": "${command:cmsis-csolution.getDeviceName}",
"processorName": "${command:cmsis-csolution.getProcessorName}",
"problemMatcher": [],
"label": "Flash Device"
}
]
}
Binary file added Docs/lcm-arm-cmsis-vscode.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion LCM/Code/App/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ typedef enum
} CELL_TYPE;

//#define PINTV
#define XRV
//#define XRV
//#define GTV
//#define ADV

Expand Down
24 changes: 12 additions & 12 deletions LCM/Code/App/vesc_uasrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
uint8_t VESC_RX_Buff[80];
uint8_t VESC_RX_Flag = 0;

#ifdef GTV
#define FIRMWARE_ID "GTV_2_1_5"
#endif
#ifdef XRV
#define FIRMWARE_ID "XRV_2_1_5"
#endif
#ifdef PINTV
#define FIRMWARE_ID "PintV_2_1_5"
#endif
#ifdef ADV
#define FIRMWARE_ID "ADV_2_1_5"
#endif
// #ifdef GTV
// #define FIRMWARE_ID "GTV_2_1_5"
// #endif
// #ifdef XRV
// #define FIRMWARE_ID "XRV_2_1_5"
// #endif
// #ifdef PINTV
// #define FIRMWARE_ID "PintV_2_1_5"
// #endif
// #ifdef ADV
// #define FIRMWARE_ID "ADV_2_1_5"
// #endif

// Access ADC values here to determine riding state
extern float ADC1_Val, ADC2_Val;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cbuild-pack:
resolved-packs:
- resolved-pack: HKMicroChip::HK32F030xMxx_DFP@1.0.17
selected-by-pack:
- HKMicroChip::HK32F030xMxx_DFP
104 changes: 104 additions & 0 deletions LCM/Project/MDK5/LCM_Light_Control_IO_WS2812_New.cproject.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
project:
output:
base-name: v$VERSION$_$TargetType$
type: hex
packs:
- pack: HKMicroChip::HK32F030xMxx_DFP
setups:
- setup: Options for LCMLightControlIOWS2812New
add-path:
- ../../Code/App
- ../../Code/Drive
- ../../Code/User
- ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/inc
- ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/CMSIS/CM0/Core
- ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/CMSIS/HK32F030M/Include
define:
- HK32F030M
- HK32F030MF4P6
misc:
- C:
- -std=c99
C-CPP:
- -fno-rtti
- -funsigned-char
- -fshort-enums
- -fshort-wchar
- -ffunction-sections
- -Wno-packed
- -Wno-missing-variable-declarations
- -Wno-missing-prototypes
- -Wno-missing-noreturn
- -Wno-sign-conversion
- -Wno-nonportable-include-path
- -Wno-reserved-id-macro
- -Wno-unused-macros
- -Wno-documentation-unknown-command
- -Wno-documentation
- -Wno-license-management
- -Wno-parentheses-equality
CPP:
- -xc++
- -std=c++03
ASM:
- -masm=auto
Link:
- --map
- --load_addr_map_info
- --xref
- --callgraph
- --symbols
- --info sizes
- --info totals
- --info unused
- --info veneers
- --strict
- --summary_stderr
- --info summarysizes
linker:
- script: LCM_Light_Control_IO_WS2812_New_LCMLightControlIOWS2812New.sct
groups:
- group: Startup
files:
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/CMSIS/HK32F030M/Source/ARM/KEIL_Startup_hk32f030m.s
- group: User
files:
- file: ../../Code/User/main.c
- file: ../../Code/User/hk32f030m_it.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/CMSIS/HK32F030M/Source/system_hk32f030m.c
- group: App
files:
- file: ../../Code/App/ws2812.c
- file: ../../Code/App/crc.c
- file: ../../Code/App/vesc_uasrt.c
- file: ../../Code/App/test.c
- file: ../../Code/App/task.c
- file: ../../Code/App/flag_bit.c
- group: Drive
files:
- file: ../../Code/Drive/led.c
- file: ../../Code/Drive/time.c
- file: ../../Code/Drive/spi.c
- file: ../../Code/Drive/power.c
- file: ../../Code/Drive/led_pwm.c
- file: ../../Code/Drive/key.c
- file: ../../Code/Drive/buzzer.c
- file: ../../Code/Drive/usart.c
- file: ../../Code/Drive/adc.c
- file: ../../Code/Drive/io_ws2812.c
- file: ../../Code/Drive/eeprom.c
- group: Library
files:
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_adc.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_gpio.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_iwdg.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_misc.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_rcc.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_spi.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_syscfg.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_tim.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_usart.c
- file: ../../Library/HK32F030Mxx_Library_V1.1.6/HK32F030M/HK32F030M_Lib/src/hk32f030m_flash.c
- group: Readme
files:
- file: ../../Readme/Readme.txt
37 changes: 37 additions & 0 deletions LCM/Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
solution:
created-by: uv2csolution@1.5.0
created-for: CMSIS-Toolbox@2.4.0
compiler: AC6@6.22.0
variables:
- VERSION: 2_1_5

target-types:
- type: ADV
define:
- ADV
- FIRMWARE_ID: '"ADV_$VERSION$"'
device: HK_MicroChip::HK32F030MF4P6
- type: GTV
define:
- GTV
- FIRMWARE_ID: '"GTV_$VERSION$"'
device: HK_MicroChip::HK32F030MF4P6
- type: PINTV
define:
- PINTV
- FIRMWARE_ID: '"PINTV_$VERSION$"'
device: HK_MicroChip::HK32F030MF4P6
- type: XRV
define:
- XRV
- FIRMWARE_ID: '"XRV_$VERSION$"'
device: HK_MicroChip::HK32F030MF4P6
build-types:
- type: Debug
optimize: debug
debug: on
- type: Release
optimize: size
debug: off
projects:
- project: LCM_Light_Control_IO_WS2812_New.cproject.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; ***********************************************************************
; *** Scatter-Loading Description File generated by uv2csolution ***
; ***********************************************************************

LR_IROM1 0x08000000 0x00004000 { ; load region size_region
ER_IROM1 0x08000000 0x00004000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20000000 0x00000800 { ; RW data
.ANY (+RW +ZI)
}
}

19 changes: 19 additions & 0 deletions LCM/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@REM ADV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+ADV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+ADV
copy Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/ADV/Release/*.hex .

@REM GTV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+GTV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+GTV
copy Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/GTV/Release/*.hex .

@REM PINTV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+PINTV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+PINTV
cp Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/PINTV/Release/*.hex .

@REM XRV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+XRV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+XRV
copy Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/XRV/Release/*.hex .
19 changes: 19 additions & 0 deletions LCM/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ADV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+ADV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+ADV
cp Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/ADV/Release/*.hex ./

# GTV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+GTV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+GTV
cp Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/GTV/Release/*.hex ./

# PINTV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+PINTV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+PINTV
cp Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/PINTV/Release/*.hex ./

# XRV
cbuild setup Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+XRV --packs
cbuild Project/MDK5/LCM_Light_Control_IO_WS2812_New.csolution.yml --context-set --context LCM_Light_Control_IO_WS2812_New.Release+XRV
cp Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/XRV/Release/*.hex ./
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Floatwheel LCM Firmware

#### Linux Prerequisites

1. Install `curl` and `libncurses5` via your package manager of choice

## Setting up the project

1. Install [Visual Studio Code](https://code.visualstudio.com)
1. Open `floatwheel` folder in Visual Studio Code
1. Install [Keil Studio Pack](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack) extension [^1]
1. Wait for Arm Tools to finish downloading / installing [^2][^3]
1. Activate Keil MDK Community license when prompted
1. Open a terminal in Visual Studio Code
1. Input `cpackget add LCM/HKMicroChip.HK32F030xMxx_DFP.1.0.17.pack` and press Enter/Return [^4]
1. Use CMSIS tab to select target device and build / debug[^5]

![Example build environment](./Docs/lcm-arm-cmsis-vscode.jpg "Example build environment")

Build scripts are also included: `LCM/build.sh` (Linux / Mac OS) `LCM/build.bat` (Windows)

They build firmware for all 4 configurations, then copy the created `<device>_<version>.hex` files into the `LCM` directory. The intention is to use them when releasing new versions until a future solution is reached.

[^1]: This should be suggested automatically
[^2]: Located on the bottom bar, will show either Arm Tools: x or Installing...(xx%)
[^3]: This process takes quite some time. Check `Output -> Arm Tools` for details
[^4]: Try adding `~/.vcpkg/artifacts/2139c4c6/tools.open.cmsis.pack.cmsis.toolbox/2.6.1/bin/` to $PATH if you're having issues running cpackget
[^5]: .hex file located at `LCM/Project/MDK5/out/LCM_Light_Control_IO_WS2812_New/<device>` in Debug / Release folder
16 changes: 16 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"registries": [
{
"name": "arm",
"kind": "artifact",
"location": "https://artifacts.tools.arm.com/vcpkg-registry"
}
],
"requires": {
"arm:tools/open-cmsis-pack/cmsis-toolbox": "2.6.1",
"arm:compilers/arm/armclang": "6.22.0",
"arm:tools/kitware/cmake": "3.28.4",
"arm:compilers/arm/llvm-embedded": "19.1.1",
"arm:tools/ninja-build/ninja": "1.12.0"
}
}