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. so even implementing `start` would not help us.
We need to replace the operating system entry point. 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`, You could for example name a function after the default entry point,
and start that way. Note, you would also need to disable [name mangling][nm]: which for linux is `_start`, and start that way.
Note, you would also need to disable [name mangling][nm]:
``` rust ``` rust
#![no_std] #![no_std]
@@ -164,7 +165,7 @@ pub extern "C" fn _start() -> ! {
[nm]: https://en.wikipedia.org/wiki/Name_mangling [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. 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 ## microbit crate
@@ -385,6 +386,11 @@ fn main() -> ! {
It is all a bit ugly, but fortunately it only needs to be done once. 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`! 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 ## Build Complete
As a sanity check, let's verify that the produced executable is actually an ARM binary: As a sanity check, let's verify that the produced executable is actually an ARM binary:

View File

@@ -1 +1,3 @@
# Hello world # 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? 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 you should be able to figure out how to get access to the gpio,
and set individual pins high and low: and set individual pins high and low:
[microbit]: https://docs.rs/microbit/0.5.1/microbit/
``` rust ``` rust
if let Some(p) = microbit::Peripherals::take() { if let Some(p) = microbit::Peripherals::take() {
let mut gpio = p.GPIO.split(); 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> <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}} {{/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> </head>
<body class="light"> <body class="light">
<!-- Work around some values being stored in localStorage wrapped in quotes --> <!-- Work around some values being stored in localStorage wrapped in quotes -->