enable ethernet on atlas (#3348)

* enable h7 ethernet

* some ethernet settings while we're here

* mac address

* misc

* extra spaces

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2021-10-16 09:31:53 -07:00 committed by GitHub
parent b4a9d7b1fc
commit 1a0bce808a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 7 deletions

16
.vscode/tasks.json vendored
View File

@ -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",

@ -1 +1 @@
Subproject commit 45965706d04b640c2dd7d267afc63e82aac56a32
Subproject commit 8bae576fdde4e2220bfdc577ca71920bcf1043b2

View File

@ -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)

View File

@ -1,5 +1,5 @@
#!/bin/bash
export PROJECT_BOARD=atlas
export PROJECT_CPU = ARCH_STM32H7
export PROJECT_CPU=ARCH_STM32H7
bash ../common_make.sh

View File

@ -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();
}

View File

@ -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__ */