Internet of things

Von Neumann Basic Structure

Hardware Layer

HAL

  1. Microprocessor
  2. Peripherals
  3. Peripheral device

Software layer

Software layer

  1. BSP: Board Support Packet

BSP implemented 2 functionailites, the first is system guide, including MPU initialization, the second is support DDI(Device Driver Interface) to devices and communications between system and peripherals

  1. RTOS: Real Time Operation System

Scheduler, Storage distribution, Clock management, Interrupts, File/GUI/Net serveices are managed by BASIC KERNEL; Graphics/Automobile/Homekits etc. are managed by EXTENDED KERNEL

  1. API: Application Programmable Interface

Also referred as middlewares, all software libraries or components are developed at this layer. This layer varies by DDD(Domain Drive Design)

  1. Softwares

Text editor/Games/Electronic control/Media players etc.

CPU (Centrol Processing Unit)

Basic CPU structure

ARM Cortex-M7 processor core peripherals

Cortex M7 Processor mode and privilege levels for software execution

The processor modes are:

The privilege levels for software execution are:

Unprivileged software executes at the unprivileged level.

Privileged software executes at the privileged level.

In Thread mode, the CONTROL register controls whether software execution is privileged or unprivileged, see CONTROL register. In Handler mode, software execution is always privileged.

Only privileged software can write to the CONTROL register to change the privilege level for software execution in Thread mode. Unprivileged software can use the SVC instruction to make a supervisor call to transfer control to privileged software.

ARM - Cortex M Core registers

Register data constantly changes, data is loaded in from memroy, results are stored back to memory

Application Binary Interface(ABI) provides architecture details to Compiler/Software Programmer

CPU Registers

ARM M7 Core register set summary

Register Definition Files

Platform File that provides interface to peripheral memory by specifying

Peripheral Access Methods used to read/write data

Flash, SRAM, Peripherals, GPIO are platform dependent, details on platform specific registers can be put in C-Programming source files(Register Definition Files)

Compilation tracks and maps memory needs program code and data into segments, which are specified in the Linker file

Use Pointers(address) !!!

Memory Model

data types

Manages all data memory accesses as either little-endian or big-endian depending on how your implementation is defined. Instruction memory and Private Peripheral Bus (PPB) accesses are always performed as little-endian

Memory Region, types and attribute

The processor has a fixed default memory map that provides up to 4GB of addressable memory. The memory map is:

memory model

Behavior of memory accesses

Memory endianness

Memory-mapped I/O is a technique where peripheral registers are mapped to specific memory addresses in the microcontroller's address space. By reading from and writing to these memory addresses, developers can access and control peripheral functionality directly. memory-mapped peripheral registers in embedded systems are special registers that map physical addresses to control peripheral devices

In embedded systems programming, the memory address of a peripheral register is typically calculated by adding the register's offset (specified in the device datasheet or reference manual) to the base address of the peripheral. This allows direct access to the register's memory location

Memory Map provides a memory address to physical device mapping within an address space for use in programming

Linker file maps physical memory regions to compiled memory sections, the compiled memory sections of a compiled executable will be relocated by referencing a symbol name. linker file provides physical address to symbol mapping

Memory Map

Memory Hierarchy

*       Registers
**      Cache(L1/L2/L3)
***     RAM(SRAM/DRAM)
****    Flash/EEPROM
*****   HDD(Hard Drives)
******  Tape

Top 4 layer are used in Embedded systems,
layers towards top are expensive, fast(low latency), small capacity,
towards bottom  are cheap, slow(high latency), large capacity
Typically FLASH stores program's code instruction
RAM stores program's data

Memory Segments

Memory Segments

Data Segments

Data Allocation

int A_BSS:
int B_BSS = 0;
int C_DATA = 1;
const int D_RODATA = 1;

void foo(int E_STACK_REG) {
    int F_STACK_REG;
    int G_STACK_REG = 1;
    static int H_BSS;
    static int I_BSS = 0;
    static int J_DATA = 1;
    char * ptr_STACK_REG;
    ptr_STACK_REG = (char *) malloc(8);
    /* more code */
    free((void *)ptr_STACK_REG);
    return;
}

Memory organization

Microcontroller Memory

Volatile Memories Non-Volatile Memories
SRAM ROM/PROM/EPROM/EEPROM
DRAM FLASH
SDRAM DISK
Register(most) Tape

Interface methods for hardware

Embedded Hardware Interface

Embedded system architecture

Embedded system board

Technical Reference Material

engineering hardware drawings

Sensors Introduction

Platforms


Page Source