Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better autogen #247

Merged
merged 7 commits into from
Jan 14, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
wget https://raw.githubusercontent.com/uw-midsun/box/master/requirements.sh
chmod +x ./requirements.sh
sudo ./requirements.sh
pip install -r requirements.txt --upgrade

- name: Install STM32 toolchain
env:
Expand Down
6 changes: 3 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,6 @@ min-public-methods=2
[EXCEPTIONS]

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
# "builtins.BaseException, builtins.Exception".
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
39 changes: 27 additions & 12 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import os
import sys
import subprocess
from scons.common import parse_config
from scons.new_task import make_new_task

###########################################################
# Build arguments
Expand Down Expand Up @@ -64,7 +63,6 @@ AddOption(
action='store'
)


# Adding Memory Report Argument to Environment Flags
# Note platform needs to be explicitly set to arm

Expand Down Expand Up @@ -160,36 +158,39 @@ PLATFORM_DIR = Dir('#/platform')

VariantDir(OBJ_DIR, '.', duplicate=0)

COMMAND = COMMAND_LINE_TARGETS[0] if COMMAND_LINE_TARGETS else None

###########################################################
# Build
###########################################################
SConscript('scons/build.scons', exports='VARS')
if COMMAND == None or COMMAND == "test":
SConscript('scons/build.scons', exports='VARS')

###########################################################
# Testing
###########################################################
SConscript('scons/test.scons', exports='VARS')
if COMMAND == "test":
SConscript('scons/test.scons', exports='VARS')

###########################################################
# Helper targets
###########################################################
SConscript('scons/new_target.scons', exports='VARS')
Alias('new_task', env.Command('new_task.txt', [], make_new_task))
if COMMAND == "new_task":
SConscript('scons/new_target.scons', exports='VARS')

###########################################################
# Clean
###########################################################
# 'clean.txt' is a dummy file that doesn't get created
# 'clean' is a dummy file that doesn't get created
# This is required for phony targets for scons to be happy
clean = Command('clean.txt', [], 'rm -rf build/*')
Alias('clean', clean)
Command('#/clean', [], 'rm -rf build/*')
# Alias('clean', clean)

###########################################################
# Linting and Formatting
###########################################################
SConscript('scons/lint_format.scons', exports='VARS')


if COMMAND == "lint" or COMMAND == "format":
SConscript('scons/lint_format.scons', exports='VARS')

# ELFs are used for gdb and x86
def proj_elf(proj_name, is_smoke=False):
Expand Down Expand Up @@ -241,6 +242,11 @@ if PLATFORM == 'arm' and TYPE == 'project':

# flash the MCU using openocd
def flash_run(target, source, env):
import serial
output = subprocess.check_output(["ls", "/dev/serial/by-id/"])
device_path = f"/dev/serial/by-id/{str(output, 'ASCII').strip()}"
serialData = serial.Serial(device_path,115200)

OPENOCD = 'openocd'
OPENOCD_SCRIPT_DIR = '/usr/share/openocd/scripts/'
PROBE = 'cmsis-dap'
Expand All @@ -256,6 +262,15 @@ if PLATFORM == 'arm' and TYPE == 'project':
]
cmd = 'sudo {}'.format(' '.join(OPENOCD_CFG))
subprocess.run(cmd, shell=True)

while True:
line: str = serialData.readline().decode("utf-8")
print(line, end='')
if line.startswith('OK'):
break
if line.startswith('FAIL'):
fails += 1
break

flash = Command('flash.txt', [], flash_run)
Depends(flash, proj_bin(TARGET))
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/babydriver.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/bms_carrier.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
29 changes: 0 additions & 29 deletions libraries/codegen/boards/boards.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions libraries/codegen/boards/can_communication.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
# reserved ID. The higher ID the lower the priority. Generally
# - 0-13: Critical messages (have ACK)
# - 14-30: Actionable messages (trigger a change in another system)
# - 30-63: Data messages (usually not actionable by an onboard device)

---
Messages:
one_shot_msg:
Expand Down
10 changes: 10 additions & 0 deletions libraries/codegen/boards/can_debug.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
# reserved ID. The higher ID the lower the priority. Generally
# - 0-13: Critical messages (have ACK)
# - 14-30: Actionable messages (trigger a change in another system)
# - 30-63: Data messages (usually not actionable by an onboard device)

---
Messages:
test_debug:
Expand Down
6 changes: 3 additions & 3 deletions libraries/codegen/boards/centre_console.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand All @@ -11,7 +11,7 @@
---
Messages:
cc_power_control:
id: 8
id: 1
target:
power_distribution:
watchdog: 0
Expand All @@ -23,7 +23,7 @@
length: 8

drive_output:
id: 9
id: 2
target:
motor_controller:
watchdog: 0
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/charger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
10 changes: 5 additions & 5 deletions libraries/codegen/boards/motor_controller.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand All @@ -11,7 +11,7 @@
---
Messages:
motor_controller_vc:
id: 35
id: 30
target:
centre_console:
watchdog: 0
Expand All @@ -26,7 +26,7 @@
length: 16

motor_velocity:
id: 36
id: 31
target:
centre_console:
watchdog: 0
Expand All @@ -37,7 +37,7 @@
length: 16

motor_status:
id: 37
id: 32
target:
centre_console:
watchdog: 0
Expand Down Expand Up @@ -97,7 +97,7 @@
length: 8

precharge_completed:
id: 16
id: 14
target:
centre_console:
watchdog: 0
Expand Down
10 changes: 10 additions & 0 deletions libraries/codegen/boards/new_can.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
# reserved ID. The higher ID the lower the priority. Generally
# - 0-13: Critical messages (have ACK)
# - 14-30: Actionable messages (trigger a change in another system)
# - 30-63: Data messages (usually not actionable by an onboard device)

---
Messages:
transmit_msg1:
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/pedal.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/power_distribution.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/power_select.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
44 changes: 0 additions & 44 deletions libraries/codegen/boards/solar_5_mppts.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions libraries/codegen/boards/solar_6_mppts.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion libraries/codegen/boards/solar_sense.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
2 changes: 1 addition & 1 deletion libraries/codegen/boards/steering.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Message Definitions in plaintext are on the wiki at:
# https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/50003973/CAN+Message+Definitions
# https://uwmidsun.atlassian.net/l/cp/Pxn8Xhm8
#
# If you are making changes to this file please update the corresponding entry
# on the wiki. If you need to add a new message use a reasonable
Expand Down
Loading