tinygo
tinygo copied to clipboard
Don't depend board definition
I'm deploping a program on stm32f429, I don't want use any predefined board, because it's a custom board, and I want define it in my project. So I create a project with structure likes below:
PROJ/
main.go
go.mod
stm32f429.json
...
Content of stm32f429.json
:
{
"inherits": ["cortex-m4"],
"build-tags": ["stm32f429", "stm32f4", "stm32"],
"serial": "none",
"linkerscript": "targets/stm32f429.ld",
"extra-files": [
"src/device/stm32/stm32f429.s"
],
"flash-method": "openocd",
"openocd-interface": "stm32f429-myboard",
"openocd-target": "stm32f4x"
}
And then I run with command:
tinygo flash -target=./stm32f429.json main.go
It outputs:
# machine
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_i2c_reva.go:132:16: undeclared name: I2C0_SCL_PIN
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_i2c_reva.go:133:16: undeclared name: I2C0_SDA_PIN
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_spi.go:55:16: undeclared name: SPI0_SCK_PIN
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_spi.go:56:16: undeclared name: SPI0_SDO_PIN
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_spi.go:57:16: undeclared name: SPI0_SDI_PIN
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_uart.go:38:15: undeclared name: UART_TX_PIN
/opt/homebrew/Cellar/tinygo/0.22.0/src/machine/machine_stm32_uart.go:39:15: undeclared name: UART_RX_PIN
I think we can remove those lines.
Yes, I would be in favor of removing those lines. However, doing that would be a breaking change. It is something I've wanted to do for a long time though.