diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d53fdf41d2..82edcb3737 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -67,6 +67,22 @@ "isDefault": true } }, + { + "label": "Build Firmware (Atlas H7)", + "type": "shell", + "command": "make -j16 PROJECT_BOARD=atlas PROJECT_CPU=ARCH_STM32H7", + "windows": { + "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=atlas PROJECT_CPU=ARCH_STM32H7'" + }, + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, { "label": "Build Firmware (hellen72)", "type": "shell", diff --git a/firmware/ChibiOS b/firmware/ChibiOS index 45965706d0..8bae576fdd 160000 --- a/firmware/ChibiOS +++ b/firmware/ChibiOS @@ -1 +1 @@ -Subproject commit 45965706d04b640c2dd7d267afc63e82aac56a32 +Subproject commit 8bae576fdde4e2220bfdc577ca71920bcf1043b2 diff --git a/firmware/config/boards/atlas/board.mk b/firmware/config/boards/atlas/board.mk index fd1fccb236..2b8b9bed99 100644 --- a/firmware/config/boards/atlas/board.mk +++ b/firmware/config/boards/atlas/board.mk @@ -11,11 +11,15 @@ DDEFS += -DFIRMWARE_ID=\"atlas\" -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS # DEFS += -DEFI_SOFTWARE_KNOCK=TRUE # disable hardware serial ports on H7 -DDEFS += -DTS_NO_PRIMARY -DTS_NO_SECONDARY +# DDEFS += -DTS_NO_PRIMARY -DTS_NO_SECONDARY -# We are running on Proteus hardware! +# We are running on Atlas hardware! DDEFS += -DHW_ATLAS=1 +# Atlas needs networking library +LWIP = yes +DDEFS += -DEFI_ETHERNET=TRUE + # Shared variables ALLCPPSRC += $(BOARDCPPSRC) ALLINC += $(BOARDINC) diff --git a/firmware/config/boards/atlas/compile_atlas.sh b/firmware/config/boards/atlas/compile_atlas.sh index 707549e846..d8261331ed 100644 --- a/firmware/config/boards/atlas/compile_atlas.sh +++ b/firmware/config/boards/atlas/compile_atlas.sh @@ -1,5 +1,5 @@ #!/bin/bash export PROJECT_BOARD=atlas -export PROJECT_CPU = ARCH_STM32H7 +export PROJECT_CPU=ARCH_STM32H7 bash ../common_make.sh diff --git a/firmware/console/ethernet_console.cpp b/firmware/console/ethernet_console.cpp index 5963b5d572..ff8283b215 100644 --- a/firmware/console/ethernet_console.cpp +++ b/firmware/console/ethernet_console.cpp @@ -37,11 +37,11 @@ public: } void write(const uint8_t* buffer, size_t size) override { - lwip_send(connectionSocket, buffer, size, 0); + lwip_send(connectionSocket, buffer, size, /*flags =*/ 0); } - size_t readTimeout(uint8_t* buffer, size_t size, int timeout) override { - auto result = lwip_recv(connectionSocket, buffer, size, 0); + size_t readTimeout(uint8_t* buffer, size_t size, int /*timeout*/) override { + auto result = lwip_recv(connectionSocket, buffer, size, /*flags =*/ 0); if (result == -1) { do_connection(); @@ -78,6 +78,8 @@ struct EthernetThread : public TunerstudioThread { static EthernetThread ethernetConsole; void startEthernetConsole() { +#ifndef STM32H7 + // TODO: why does this break H7? I thought the pins were the same? efiSetPadMode("ethernet", GPIOA_1, PAL_MODE_ALTERNATE(0xb)); efiSetPadMode("ethernet", GPIOA_2, PAL_MODE_ALTERNATE(0xb)); efiSetPadMode("ethernet", GPIOA_7, PAL_MODE_ALTERNATE(0xb)); @@ -91,6 +93,7 @@ void startEthernetConsole() { efiSetPadMode("ethernet", GPIOG_11, PAL_MODE_ALTERNATE(0xb)); efiSetPadMode("ethernet", GPIOG_13, PAL_MODE_ALTERNATE(0xb)); efiSetPadMode("ethernet", GPIOG_14, PAL_MODE_ALTERNATE(0xb)); +#endif // STM32H7 ethernetConsole.Start(); } diff --git a/firmware/console/lwipopts.h b/firmware/console/lwipopts.h index 618aada2c1..a64714b924 100644 --- a/firmware/console/lwipopts.h +++ b/firmware/console/lwipopts.h @@ -60,4 +60,20 @@ #define LWIP_COMPAT_SOCKETS 0 +#define LWIP_RAW 0 +#define LWIP_TCP 1 +#define LWIP_UDP 0 +#define LWIP_STATS 0 + +// In theory we're only talking to a single PC, so we don't need a big ARP table +#define ARP_TABLE_SIZE 4 + +// ascii `rus` +#define LWIP_ETHADDR_0 0x72 +#define LWIP_ETHADDR_1 0x75 +#define LWIP_ETHADDR_2 0x73 +#define LWIP_ETHADDR_3 0x12 +#define LWIP_ETHADDR_4 0x34 +#define LWIP_ETHADDR_5 0x56 + #endif /* LWIP_HDR_LWIPOPTS_H__ */