This repository uses an OSEK-like OS on bare-metal ARM(R) Cortex(R)-M3 to calculate
Osek_pi_crunch_cm3 is a fascinating, educational and fun project
that computes up to
The backbone real-time operating system is taken directly from the OSEK-like OS implemented in Chalandi/OSEK
To compute
The required memory grows linearly with the digit count.
Approximately
The complicated and tedious
GNU/GCC gcc-arm-non-eabi is used for target system
development on *nix. The build system is based on
Standard GNUmake/shell-script.
Build on *nix* is easy using an installed gcc-arm-none-eabi
cd Osek_pi_crunch_cm3
./Build.sh 1000The build results including ELF-file, HEX-mask, MAP-file
can be found in the Output directory following the GNUmake build.
The number 1000 sets the length of the calculation result of 100, 1000, 10000, 100000 for respectively
higher digit counts up to
If gcc-arm-none-eabi is not present, then it can be installed (if needed).
sudo apt install gcc-arm-none-eabiThis repo features a fully-worked-out prototype example project. The prototype runs on an ARM(R) Cortex(R)-M3 controller fitted on the SMT32F100RB-NUCLEO board. The board is driven in OS-less, bare-metal mode.
The Idle). Upon successful calculation completion,
pin PB9 is toggled. This provides a measure of success viewable
with a digital oscilloscope.
Simultaneously task T1 exercises a perpetual, simple blinky show
featuring the two user LEDs (green and blue) toggling at approximately
LCD visualization uses the SerLCD 20x4 from SparkFun. The LCD driver software in the C-language has been adopted from imahjoub/STM32L432_FlashMaster.
The hardware setup is pictured in the image below.
Additional images show close-ups of the peripheral circuitry and the serial SRAM connections.
Bit banging is used to implement an all-software, SPI-compatible
driver which controls the external SRAM memory chip. A significant
amount of external SRAM is needed to hold the potentially very large
data array used for intermediate storage in the
The output pin connections from the board to the SRAM chip are shown in the table below.
| NUCLEO PIN | SRAM PIN | SPI Function |
|---|---|---|
PA11 |
CE (SRAM-chip-select-not) |
|
PA10 |
SO (SRAM-serial-out) |
|
PA09 |
CLK (SRAM-serial-clock) |
|
PA08 |
SI (SRAM-serial-in) |
The output pin connections from the board to the SparkFund SerLCD are shown in the table below. The SerLCD is driven with SPI communication with another instance of the all-software SPI driver.
| NUCLEO PIN | SPI Function |
|---|---|
PB00 |
SCK (LCD-serial-clock) |
PB01 |
SDI (LCD-serial-in) |
PB02 |
CN (LCD chip-select-not) |
The serial SRAM driver is a nice, semi-intentional by-product of this project. This driver can be found in the file mcal_memory_sram_generic_spi.h. It has been written in C++14 utilizing a fully generic, multi-chip, variable-page-size, template form.
The serial SRAM driver provides a simple interface having functions
read()/write() and read_n()/write_n() for reading
and writing single-byte or multiple-byte streams.
Using this SRAM driver requires providing an independent
SPI driver having particular interface functions such as
send()/send_n() and recv().
The spigot algorithm for
| Digits-10 | Time [s] | Ratio (to |
|---|---|---|
The runtime increases by a factor of approximately
The operating system OSEK and timer files in the MCAL are licensed under GPL. This is consistent with the licensing found in and adopted from Chalandi/OSEK.
The supporting files in ref_app and the pi_spigot application itself are licensed under BSL.
Win*-ported *nix tools in wbin originate from UnxTools and include their own distribution statements.
The Win*-ported GNUmake is taken from ckormanyos/make-4.2.1-msvc-build.


