Skip to content

Commit acff02a

Browse files
committed
content: update the board count and homepage text
Signed-off-by: deadprogram <[email protected]>
1 parent a431f62 commit acff02a

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ title: "TinyGo Home"
2020
{{% blocks/lead color="secondary" %}}
2121
TinyGo brings the [Go programming language](https://golang.org) to embedded systems and to the modern web by creating a new compiler based on [LLVM](https://llvm.org/).
2222

23-
You can compile and run TinyGo programs on over 94 different microcontroller boards such as the [BBC micro:bit](https://www.microbit.co.uk/) and the [Arduino Uno](https://store.arduino.cc/usa/arduino-uno-rev3/). [Click here for the complete list](/docs/reference/microcontrollers)
23+
You can compile and run TinyGo programs on over 100 different microcontroller boards from maker boards such as the [BBC micro:bit](https://www.microbit.co.uk/) and the [Arduino Uno](https://store.arduino.cc/usa/arduino-uno-rev3/), to industrial processors from [Nordic Semiconductor](https://www.nordicsemi.com/) and [ST Microelectronics](https://www.st.com/). [Click here for the complete list](/docs/reference/microcontrollers)
2424

2525
TinyGo can also produce [WebAssembly (WASM)](https://webassembly.org/) code which is very compact in size. You can compile programs for web browsers, as well as for server and edge computing environments that support the [WebAssembly System Interface (WASI)](https://github.com/WebAssembly/WASI) family of interfaces.
2626

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "Adding runtime support for new processors"
3+
weight: 1
4+
description: >
5+
How to add runtime support to a new processor.
6+
---
7+
8+
In order for a processor to support `time.Sleep()` and other things you normally expect, there are some functions that need to be implemented in the runtime for that processor.
9+
10+
## runtime timers/sleep
11+
12+
Functions that need to be implemented:
13+
14+
```go
15+
// timeUnit defines the type of the unit of time used for that processor per tick.
16+
// can be measured in nanoseconds, microseconds, or milliseconds.
17+
// the important part is that it be consistent for any particular processor.
18+
type timeUnit int64
19+
20+
// ticksToNanoseconds converts ticks to nanoseconds
21+
func ticksToNanoseconds(ticks timeUnit) int64
22+
23+
// nanosecondsToTicks converts nanoseconds to ticks
24+
func nanosecondsToTicks(ns int64) timeUnit
25+
26+
// sleepTicks should sleep for d number of ticks.
27+
func sleepTicks(d timeUnit)
28+
29+
// ticks returns the elapsed time since reset as a number of timeUnit ticks
30+
func ticks() timeUnit
31+
```
32+
33+
Defining the `timeUnit` is crucial, since the unit of time for most processors is usually dependant on the system clock settings.
34+
35+
Based on that initial information, the functions `ticksToNanoseconds()` and `nanosecondsToTicks()` can be implemented in a fairly straightforward fashion.
36+
37+
It is with the function `sleepTicks()` that implementation details become very important. This function needs to be able to yield the processor to perform other tasks while it is waiting, in order for it to work the way that you expect with Go routines.
38+
39+
Lastly the `ticks()` function is needed, in order for many `time` package functions to work.

content/docs/reference/microcontrollers/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: |
88

99
TinyGo lets you run Go directly on microcontrollers.
1010

11-
TinyGo has support for 85 different boards and devices such as the Arduino Nano33 IoT, Adafruit Circuit Playground Express, BBC micro:bit and more. Click on a board name below to see the what features are supported for the given hardware.
11+
TinyGo has support for over 100 different boards and devices such as the Arduino Nano33 IoT, Adafruit Circuit Playground Express, BBC micro:bit and more. Click on a board name below to see the what features are supported for the given hardware.
1212

1313
Support for some boards and processor types are more complete than others.
1414
As of early 2023, boards using the following microcontrollers are

0 commit comments

Comments
 (0)