1/115
Looks like no tags are added yet.
What is von Neumann (Princeton) memory architecture?
Instructions and data use a shared memory system/path.
What is a main drawback of von Neumann architecture?
Instruction fetch and data access can compete for the same path.
What is Harvard memory architecture?
Separate instruction and data memory paths.
Why can Harvard architecture improve throughput?
Instruction fetch and data access can occur simultaneously.
What is the distinction between memory contents and paths?
Data/instructions are contents; buses/access paths determine simultaneous access.
How many visible general registers are listed for ARM Cortex-M?
R0 through R15: 16 registers, each 32 bits wide.
What do R0–R7 represent?
Low general-purpose registers.
What do R8–R12 represent?
High general-purpose registers.
What is R13?
Stack pointer (SP).
What does the stack pointer indicate?
The current top-of-stack location in memory.
What is R14?
Link register (LR), holding return information for calls.
What is R15?
Program counter (PC), used to track instruction execution.
What are the main ARM instruction categories in the notes?
Data processing, memory operations, control flow, and other/system instructions.
Name arithmetic operations mentioned.
ADD, ADC, SUB, MUL, and DIV.
What does ADD do?
Adds operands.
What does ADC do in ARM?
Adds operands together with the carry flag.
What does SUB do?
Subtracts one operand from another.
What do MUL and DIV do?
Multiply and divide operands.
What do shift instructions do?
Shift bits left or right.
Name ARM shift types in the notes.
LSL, LSR, ASR, and rotate.
How does LSL work?
Logical left shift; bits shift left and zeros fill the right.
How does LSR work?
Logical right shift; zeros fill the left.
How does ASR work?
Arithmetic right shift; sign bit is replicated.
What is a rotate operation?
Bits shifted out on one end reenter at the other.
Name bitwise Boolean instructions.
AND, ORR, EOR, BIC, and NOT/MVN.
What does AND do?
Sets a result bit only if both corresponding input bits are 1.
What does ORR do?
Sets a result bit if either input bit is 1.
What does EOR do?
Exclusive OR; result bit is 1 when the input bits differ.
What does BIC do?
Clears selected bits using a bitwise AND with an inverted mask.
What does CMP do?
Compares operands by subtraction and updates flags without storing the result.
What does CMN do?
Compares via addition and updates flags.
What does TST do?
Bitwise AND test that updates flags without storing a result.
What byte manipulation operations are mentioned?
Byte reversal (REV/REV16) and sign/zero extension.
What do SXTB and SXTH do?
Sign-extend a byte or halfword into a register.
What do UXTB and UXTH do?
Zero-extend a byte or halfword into a register.
What is an opcode?
The instruction field specifying the operation.
What is an operand?
A value, register, or location used by an instruction.
What is an immediate operand?
A constant encoded within the instruction.
What is a register operand?
A value sourced from or placed in a CPU register.
What are the two Thumb instruction lengths noted?
16-bit and 32-bit encodings.
Why use mixed 16/32-bit instruction lengths?
Balance compact code with more capable instruction encodings.
What tradeoff comes with 16-bit instruction encoding?
Compact code but fewer bits for operands/operations.
What tradeoff comes with 32-bit instruction encoding?
More encoding capacity but greater code size per instruction.
How can a Thumb decoder distinguish instruction lengths?
It examines leading bits of the instruction halfword.
What happens in a conditional branch?
Execution changes address only if a flag condition is satisfied.
What does B do?
Branches to another instruction address.
What does BL do?
Branches with link to call a function and saves return information in LR.
What does BX do?
Branches to the address held in a register.
What does BLX do?
Branches with link using a register/target, depending on encoding.
Name conditional branches in the notes.
BEQ, BNE, CBZ, and CBNZ.
What does BEQ test?
Equal/zero condition flag (Z = 1).
What does BNE test?
Not-equal/zero flag clear (Z = 0).
What does CBZ do?
Branches if the tested register contains zero.
What does CBNZ do?
Branches if the tested register is nonzero.
How does a function commonly return on Cortex-M?
Branch to the saved return address, commonly with BX LR.
What does LDR do?
Loads a value from memory into a register.
What does STR do?
Stores a register value into memory.
What does PUSH do?
Saves selected registers onto the stack.
What does POP do?
Restores selected registers from the stack.
What does LIFO mean?
Last in, first out: newest saved item is removed first.
What is the stack?
A region of RAM used for calls, saved registers, and local data.
How is stack storage managed?
Typically automatically by generated code using SP adjustments.
What happens to SP on a common descending Cortex-M stack push?
It decreases as data is pushed.
What happens to SP on a corresponding pop?
It increases as data is removed.
What is register-direct addressing?
The operand value is in a named register.
What is immediate addressing?
The operand value is encoded in the instruction.
What is register-indirect memory addressing?
A register contains the memory address to access.
What is direct memory addressing (conceptually)?
The instruction specifies a memory address directly.
What is indirect memory addressing (conceptually)?
A stored pointer/address is used to locate the operand.
What is the stack's role in a function call?
Preserves return information, registers, and local variables as needed.
Why must SP be updated when reserving stack space?
So subsequent stack use does not overwrite active local data.
What is wrong with writing to [SP,#-4] without reserving space?
The write may be outside allocated stack space and be overwritten.
Why must saved registers be restored?
To preserve caller-visible state required by the calling convention.
What is the heap?
A RAM region for dynamically allocated objects.
How is the heap typically managed in C?
Explicit allocation with functions such as malloc and free.
How are stack and heap allocation different?
Stack is tied to function scope; heap allocation persists until freed.
What is heap memory useful for?
Data whose required size or lifetime is decided at runtime.
What can happen if heap memory is never freed?
Memory leakage and eventual exhaustion.
What is the first source-language stage of program creation?
Write source code, e.g., C.
What does the compiler do?
Translates high-level source into target assembly or machine-level code.
What does the assembler do?
Translates assembly instructions into machine code in object files.
What is an object file?
Compiled code/data that may still contain unresolved references.
What does .o typically represent?
A relocatable object file.
What is a relocatable object?
Code/data not yet assigned all final memory addresses.
What does a linker do?
Combines object files/libraries and resolves symbols and references.
Why are libraries provided to the linker?
To supply reusable compiled code or data.
What is an ELF file?
An executable and linkable file format containing code/data plus metadata.
Is .text a separate file extension?
No; .text is a section inside ELF/object files.
What is the .text section?
Executable program instructions, usually stored in flash.
What is the .data section?
Initialized writable variables, used in RAM at runtime.
Where are initial .data values kept before startup?
Typically in the firmware image in flash.
What does startup code do with .data?
Copies initial values from flash to RAM.
What is the .bss section?
Zero-initialized or uninitialized writable variables in RAM.
What happens to .bss during startup?
It is normally zeroed before main executes.
What is the .rodata section?
Read-only constant data, commonly stored in flash.
Why don't .data and .bss mean extra ELF files?
They are named sections within one file.
What is a linker command file/script?
Rules describing how sections are placed in memory regions.
What does a locator do in this workflow?
Assigns addresses to linked sections according to memory layout rules.
What is memory mapping at link time?
Choosing addresses/regions for code, constants, and variables.
What physical constraints influence memory mapping?
RAM/flash sizes, memory speeds, permissions, and CPU architecture.