micro:bit Architecture Flashcards
What 4 components create an executable file?
The preprocessor, compiler, assembler and linker
What does the compiler do?
It transforms C commands into assembly code
What does the assembler do?
Translates assembly code to machine code
What is the collective name for the preprocessor, compiler, and assembler?
The compiler
What does the linker do?
Combine several object files together that are dependent on one another due to calling function from other files, libraries, header files etc.
What are the sections of an object file?
Text section = machine code
Data section = global constants
Relocation information = information about what to modify when linking
What happens when the address of a function in unknown?
A placeholder is inserted until the location is known
When are placeholders resolved?
During generation of an executable file
What does the linker do?
It resolves unknown addresses by using the relocation information stored in the main program and the symbol table which is stored in the not main program
Describe the linking process
- Object files include references to each other’s code and/or data
- The linker uses relocation records to fill in all addresses
- The linker combines information from the symbol table and relocation records
- Assembling to machine code remove all labels form the code
Describe static linking of libraries
The library and program are linking by the linker at runtime meaning that the binding between the program and the library is fixed, this also means that if the library is changed you will need to re-link it. Takes up more disk space
Describe dynamic linking of libraries
The program and library it references are not combined in the linker. The linker simply places information into the executable and tells the loader the location of shared objects where required code can be found and the references are found during runtime. Two programs can share libraries in memory and you don’t need to re-assemble the whole program
Define microcontroller
A compact integrated circuit equipped with one or more central processing units and memory
Define embedded system
An electronic product that compromises a microcontroller or multiple microcontrollers executing software instructions stored on a memory module to perform an essential function
Micro USB
Streams data to a from the micro:bit and provides power
JST connector
Provides power when connected to a 3V battery (2 x 1.5V batteries)
ARM Cortex-M4F Processor
Interface that handles USB connection, used for flashing code and data to/from connected devices
ARM Cortex-M4 32-bit processor
Contains memory, radio capabilities, and has an integrated temperature sensor
BLE antenna
Used for Bluetooth and radio
Difference between Bluetooth and Radio capabilities in a micro:bit
Bluetooth allows the micro:bit to talk with central devices only whereas radio allows micro:bit devices to talk to each other so the peripheral can talk to devices other than central devices
Motion sensor
Accelerometer and magnetometer, contains the footprint for two sensors (LSM & FXOS) but only one is placed
Edge connector
20 pins/strips and 5 rings for connection with external components using crocodile clips or banana plugs
Regulator
Steps down to 3.3V
Xtal (Crystal)
Electronic crystal oscillator that provides the clock signal
SWD bus
Serial wire debug for programming the target MCU
UART bus
Universal asynchronous receiver-transmitter for exchanging data with the device connected to the USB
I^2C
Integer-integrated circuit bus that allows the main component (target MCU) to communicate with secondary components
Define DAPLink
An open-source interface firmware that creates a bridge between the PC and SWD
Why does the micro:bit not require a device driver?
It presents itself to the device as a USB disk
What happens when you drop code onto the micro:bit when the DAPLink is an interface mode?
The code is written into the target MCU flash memory
What is DAPLink bootloader mode?
Used to update the version of the DAPLink and the code is written to the interface MCU flash and updates the version of the DAPLink
Describe the divide and conquer method for debugging
Removing and adding code to monitor when your program works and when it breaks to indicate where the bug is
Describe logging method of debugging
Inserting printf to determine the state of your program in different locations to find the bug
What are the disadvantages of logging as a debugging method?
- Not efficient
- Requires a lot of memory
- Can cause a heisenbug
What is a heinsenbug?
A bug that occurs when you remove a printf statement and and error occurs
Why does a heisenbug happen?
Removing a printf statement causes memory allocation to change and the stack will be affected triggering bus errors
Define big endian
The MSB is stored first
Define little endian
The LSB is stored first
What class do you use to perform debugging by logging for a micro:bit?
The serial class
What does the flag -g do?
Tells the compiler to generate and embed debug symbols which include names of functions, file names, and line numbers of errors
What does the Stack pointer point to?
The lowest address of the stack for the current frame which will be the top of the stack
What does the base/frame pointer point to?
A reference address of the previous frame
What does the instruction pointer point to?
The address that the function will return to
What does stack memory contain?
Stack frames that include data needed by function calls including argument and local variables
What does heap memory contain?
Data used for variables within the program that have a dynamic size
What is the Block Starting Symbol (BSS) section of memory used for?
Global variables that are initialised to 0 or do not have explicit initialisation
What is the DATA section of memory used for?
Global variables that have been intitialised
What does the TEXT section of memory contain?
The binary executable instructions of a program
What are the pointers contained within a stack frame?
Stack pointer, frame/based pointer, saved instruction pointer
What does the OS Kernel memory contain?
Memory reserved by the OS to monitor and control mapping between virtual and physical addresses
What is the translation lookaside buffer?
A specialised cache that contains recent virtual-to-physical address translations so that the CPU can quickly retrieve them without having to refer to the table again
What is the difference between RAM and DAM?
Accessing memory addresses in DAM it takes longer because it linearly searches through each memory address to find one
Which component handles virtual-to-physical address translation?
The Memory Management Unit