microbit architecture Flashcards
embedded system
an electronic product that has 1 or more micro controllers that execute software instructions stored on a memory module to perform an essential function
microcontroller
processor/micro controller unit (mcu)
compact integrated circuit with one or more cpus and memory
runtime code/software
software platform that provides an environment for excecuting user code
acts as an abstraction layer that developers can use to write software
what does the micro usb do
streams data to and from the microbit and provides power
what is the microbit power supply
jst connector
what is daplink
open source interface firmware that creates a bridge between the pc and swd
the microbit presents itself as a usb disk
what is interface mode (daplink)
the hex dropped onto the usb disk is written into the target mcu flash
usb disk = microbit
bootloader mode (daplink)
the hex file written into the interface mcu flash and updated the version of the daplink
usb disk = maintainance
what do you type to build microbit
python3 build.py
what are the 4 parts needed in creating an executable file
preprocessor; outputs pure c code
compiler; transforms c into assembly (dependant on the machine architecture)
assembler; created machine code stored in an object file including meta data
linker; links different files together and gives every object what it needs
what are the different sections of an object file
machine code; text
required space for uninitialised data (bss; block starting symbol)
symbol tables; location of functions
relocation information; what to modify when linking
how is a symbol table used when calling library functions
when a program has several parts the address of the jump cannot be decided
a placeholder is put until the address is known and remember that the address is not resolved - managed through the symbol table in your library function and the relocation info in your program.
the linker resolves this when building the file
what is the job of the linker
linking object files and libraries
how does the linker link multiple object files
object files includes references to eachothers code and data
the linker uses relocation records to fill in all addresses then combines info from the symbol table and relocation records
assembling to machine code removes all labels from the code
in which two ways can libraries be used
statically linked archives; linked during compile time
dynamically linked shared objects; linked at runtime
static linking
program and library combines by the linker during compilation time therefore binding is fixed and you will need to link again to change the library
statically linked programmes are linked against archives (.a; multiple libraries compiled together)
what are advantages of static linking
when you compile you know what library is being used
when you copy programs you know that everything is present
what is a disadvantage of static linking
programs take more disk space
dynamic linking
linked at runtime
the linker places information into the executable that tells the loader the location of the shared object files where required code can be found during runtime
linked against shared objects (.so)
what are advantages of dynamic linking
small file sizes on the disk
libraries can be upgraded without reassembling the entire program
2 programs can store libraries in memory
what is a disadvantage of dynamic linking
libraries may change and the impact of the program is not always clear
what kind of linking is supported for the microbit
static
why dont we compile and link files in one stage
any change in a single source file would mean you would have to recompile the entire program which would be inefficient for large projects as it would consume a lot of time and resources
what does the loader do
loads code and data onto the main memory
part of the os
performs memory and access validation
performs process setup
what is part of process setup ( loader)
allocate memory
copy address space from secondary to main memory
copy program arguments to the stack
initialise registers (eg. stack pointer)
jump to start routine (copy main() and jump to main())
how does initial processing work in c
the input file is read into memory and broken into lines
continued lines are merged into one long line
all comments are replaces with single spaces