small fixes, add ganalytics

This commit is contained in:
Michael Droogleever
2018-07-22 19:54:15 +02:00
parent cb2fecd20f
commit 9d022cd9b8
4 changed files with 23 additions and 4 deletions

View File

@@ -148,8 +148,9 @@ neither the crt0 nor the rust runtime are available,
so even implementing `start` would not help us.
We need to replace the operating system entry point.
You could for example name a function after the default entry point, which for linux is `_main`,
and start that way. Note, you would also need to disable [name mangling][nm]:
You could for example name a function after the default entry point,
which for linux is `_start`, and start that way.
Note, you would also need to disable [name mangling][nm]:
``` rust
#![no_std]
@@ -164,7 +165,7 @@ pub extern "C" fn _start() -> ! {
[nm]: https://en.wikipedia.org/wiki/Name_mangling
This is the end of the road for trying to get this to work on our own.
At this point we need the help of a board specific crate and a few cargo tweaks to get this working.
At this point we need the help of a board-specific support crate and a few cargo tweaks to get this working.
## microbit crate
@@ -385,6 +386,11 @@ fn main() -> ! {
It is all a bit ugly, but fortunately it only needs to be done once.
If you try building now, you should finally be greeted with `Finished`!
``` shell
$ cargo build
Finished dev [unoptimized + debuginfo] target(s) in 20.51s
```
## Build Complete
As a sanity check, let's verify that the produced executable is actually an ARM binary:

View File

@@ -1 +1,3 @@
# Hello world
In this chapter, we will discuss the basic I/O of embedded development in rust.

View File

@@ -2,10 +2,12 @@
Let us now turn on an LED! But how?
Well, first we should look at the documentation of our crate,
Well, first we should look at the [documentation of our crate][microbit],
and you should be able to figure out how to get access to the gpio,
and set individual pins high and low:
[microbit]: https://docs.rs/microbit/0.5.1/microbit/
``` rust
if let Some(p) = microbit::Peripherals::take() {
let mut gpio = p.GPIO.split();

View File

@@ -34,6 +34,15 @@
<script async type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
{{/if}}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111729278-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-111729278-2');
</script>
</head>
<body class="light">
<!-- Work around some values being stored in localStorage wrapped in quotes -->