tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
15.25k stars 900 forks source link

Support for Infineon XMC4700 Microcontroller #1177

Open moisesesc opened 4 years ago

moisesesc commented 4 years ago

Hi TinyGo team,

I was wondering if you guys would add support for the Infineon XMC4000 series of micros. I am currently interested in the XMC4700.

Is there a guide on porting TinyGo to an MCU?

Thank you!

niaow commented 4 years ago

Normally adding a board boils down to a few steps:

  1. add support for basic peripherals (UART/usb for println output and user text input) to the machine package
  2. implement runtime code which handles hardware initialization and basic builtins (putchar for println output and a timer implementation)
  3. add a target file specifying how to build and load code for the microcontroller

Steps 1 and 2 depend on a device/manufacturer package which provides bindings to the hardware registers. This is generated from manufacturer-provided files. This is our first Infineon chip, so you would need to add generation for device/infineon. Fortunately there seem to be public SVD files for Infineon XMC chips, so most likely we can just use those with our SVD conversion script (you can see how we do the conversion here).

Also I would suggest joining the #tinygo channel on Gophers Slack.