diff --git a/src/ch1_00_introduction.md b/src/ch1_00_introduction.md index a9862da9edaeaa08fb7aacbd20e8266f618d1363..932a7ecd239f76e1911200be6580f4072cf279e2 100644 --- a/src/ch1_00_introduction.md +++ b/src/ch1_00_introduction.md @@ -1,27 +1,30 @@ -XP-el Mikroprocessorprogrammeringskurs (MPPK) -============================================= +# XP-el Mikroprocessorprogrammeringskurs (MPPK) -# Introduction to embedded programming +## Introduction to embedded programming Embedded systems are everywhere. Use-cases ranges from heavy industry to tiny sensors in your everyday life. +### Requirements -## Requirements 1. Computer 2. USB cable 3. ARM Development board -## Great resources - +### Great resources [Rust-book](https://doc.rust-lang.org/book/) covering everything Rust -[Rust-Embedded book](https://rust-embedded.github.io/book/) contains thorough instructions for getting going with embedded. -This resource is a tiny subset of the Embedded book. +[Rust-Embedded Discovery](https://docs.rust-embedded.org/discovery/) +Beginner friendly " introductory course on microcontroller-based embedded systems". -[RTFM Book](https://rtfm.rs/) contains examples and usage for the rust implementation of the RTFM framework. -# Overview - +[Rust-Embedded book](https://rust-embedded.github.io/book/) +contains thorough instructions for getting going with embedded. + +[RTFM Book](https://rtfm.rs/) contains examples and usage for the +Rust implementation of the RTFM framework. +## Overview + + diff --git a/src/ch1_01_hardware.md b/src/ch1_01_hardware.md index 9ef90eef071fd4192c440032c1afeb49c95acd47..400b7d4f2af7dff97856806f186190f104089cd3 100644 --- a/src/ch1_01_hardware.md +++ b/src/ch1_01_hardware.md @@ -2,22 +2,26 @@ <img src="images/st-logo.svg" width="500"> -In this course we will use the [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html) sponsored by ST Microelectronics. +In this course we will use the [STM32F401][1] sponsored by ST Microelectronics. A big thanks to STM for this contribution! +[1]: https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html ## ARM While your laptop/stationary computer most likely runs some `x86_64` CPU architecture, odds are your mobile phone is powered by an ARM processor. -The ARM family of Reduced Instruction Set Computing (RISC) architectures is one of the most prevalent processor architectures. +The ARM family of Reduced Instruction Set Computing (RISC) architectures is one +of the most prevalent processor architectures. For more information: [ARM on Wikipedia](https://en.wikipedia.org/wiki/ARM_architecture). ## Registers, IO -A typical way to access and interface with the hardware connected to your microcontroller is by accessing various registers, which is memory regions mapped to some hardware. +A typical way to access and interface with the hardware connected to your +microcontroller is by accessing various registers, +which is memory regions mapped to some hardware. ## Common Features @@ -59,16 +63,24 @@ Feels weird. Move out to exercises and explain there I guess... and maybe not al ##### GPIO (General Purpose Input Output) -The most rudimentary type of interface but equally the most important. As an output this pin can be **ON** or **OFF**, **TRUE** or **FALSE**, **1** or **0**. And as input this pin goes into High-Z (High impedance) mode, this means that the MCU will check the voltage of the pin and if it is above a certain threshold then it will change the register bit corresponding to the state of the pin to 1 and vice versa. +The most rudimentary type of interface but equally the most important. +As an output this pin can be **ON** or **OFF**, **TRUE** or **FALSE**, **1** or **0**. +And as input this pin goes into High-Z (High impedance) mode, +this means that the MCU will check the voltage of the pin and if it is above +a certain threshold then it will change the register bit +corresponding to the state of the pin to 1 and vice versa. -These are often sharing the same physical pin with special functions such as timers, communication buses and the like. So when booting up an MCU one should specify what function is needed on a particular pin. But beware that all functions can **NOT** be mapped to all pins. +These are often sharing the same physical pin with special functions such as +timers, communication buses and the like. +So when booting up an MCU one should specify what function +is needed on a particular pin. +But beware that all functions can **NOT** be mapped to all pins. -There is also a hardware limit to what can be driven by a GPIO pin. Usually, a pin can deliver about 20 mA but that is it. +There is also a hardware limit to what can be driven by a GPIO pin. +Usually, a pin can deliver about 20 mA but that is it. ##### ADC (Analog to Digital Converter) ## Development board ### STM32 Nucleo-64 - - diff --git a/src/ch1_02_software.md b/src/ch1_02_software.md index 988f62f2091afd03a207253ccba712dddbdf975f..136c9558d9221b9985d0d5d2256dcf25fd086314 100644 --- a/src/ch1_02_software.md +++ b/src/ch1_02_software.md @@ -2,14 +2,17 @@ In order to instruct the hardware some sort of software is required. -Software is the instructions for the ARM-processor, telling it which registers and what memory to modify. +Software are the instructions for the ARM-processor, +telling it which registers and what memory to modify. ## Toolchain -"Toolchain" refers to the collection of hardware and/or software which makes it possible to develop for some specific platform. +"Toolchain" refers to the collection of hardware and/or software +which makes it possible to develop for some specific platform. -The **compiler**, **linker** and some **hardware-interface** are typical tools found in a toolchain. +The **compiler**, **linker** and some **hardware-interface** +are typical tools found in a toolchain. ### Compiler @@ -23,7 +26,8 @@ into ready to run ARM instructions. ### Linker -The job of the linker is to turn often many output object files of the compiler and combine them into an application. +The job of the linker is to turn often many output object files of the compiler +and combine them into an application. * LD The GNU linker * LLD The LLVM project linker @@ -32,7 +36,8 @@ The job of the linker is to turn often many output object files of the compiler #### GDB / LLDB Debugger -When developing software it is very nice to have control over the execution and being able to inspect both hardware and software state. +When developing software it is very nice to have control over the execution +and being able to inspect both hardware and software state. The debuggers provides an interface for doing exactly that. @@ -42,34 +47,38 @@ The Open On-Chip Debugger Quoting its [documentation](http://openocd.org/doc-release/pdf/openocd.pdf): -"The Open On-Chip Debugger (OpenOCD) aims to provide debugging, in-system programming and boundary-scan testing for embedded target devices." +"The Open On-Chip Debugger (OpenOCD) aims to provide debugging, +in-system programming and boundary-scan testing for embedded target devices." -Since newer hardware is released and firmwares for hardware gets updated, it may be required to run a development version of OpenOCD to keep up. +Since newer hardware is released and firmwares for hardware gets updated, +it may be required to run a development version of OpenOCD to keep up. #### ST-link -STMicroelectronics provides an in-circuit debugger and programmer for the STM8 and STM32 microcontrollers. +STMicroelectronics provides an in-circuit debugger and programmer for the +STM8 and STM32 microcontrollers. -A nice feature of the STM Nucleo development boards is that the programmer is included as part of the device. +A nice feature of the STM Nucleo development boards is that the programmer +is included as part of the device. But it can also program other microcontrollers via pin headers. -#### Blackmagic probe +#### Black Magic Probe An open source hardware debugger supporting JTAG and SWD. Vendor agnostic -[Blackmagic probe github page](https://github.com/blacksphere/blackmagic/wiki) - +[Black Magic Probe github page](https://github.com/blacksphere/blackmagic/wiki) ### Git -Git is a distributed revision control system, most likely most of you have heard of it, maybe even used it. +Git is a distributed revision control system, +most likely most of you have heard of it, maybe even used it. -It allows for convenient collaboration and handles everything from small one-file projects to massive -[projects](https://github.com/torvalds/linux). +It allows for convenient collaboration and handles everything from +small one-file projects to massive [projects](https://github.com/torvalds/linux). ### Rust