GithubHelp home page GithubHelp logo

gnu-tools-baremetal-practice's Introduction

Star-up file

  • Responsible for setting up right environment for the main user code to run.

Contents of Startup file

  1. Create a vector table for your microcontroller. Vector table are MCU specific
  2. Write a start-up code which initializes .data .bss section in SRAM
  3. Call main()
  • Vector Table - contains handler addresses Search for your MCU's reference manual

Creating a Vector Table

Code memory (Flash)

------------------
Unused Code memory
------------------
.data
(initialized
global and static
variables)
-------------------
.rodata
-------------------
.text
-------------------                         ----------------------------
Vector Table          ------------------->     Addr of IRQ-N Handler 
-------------------                         ----------------------------
                                              Addr of IRQ-(N-1) Handler
                                            ----------------------------
                                                          .
                                                          .
                                                          .

                                            ----------------------------
                                                  Addr of IRQ-1 Handler
                                            ----------------------------
                                                  Initial MSP Value
                                            ----------------------------
  1. Create an array to hold MSP and handlers addresses.
uint32_t vectors[] = {store MSP and address of various handlers here}

MSP - main stack pointer (first word in the vector table)

  1. Instruct the compiler no to include the above array in .data but in a user defined section

Linker Scripts

  • Explains how different sections of the object files should be merged to create an output file
  • must be supply during linking phase

VMA - virtual memory address LMA - load memory address

Location Counter always tracks vma of the section in whic it is being used

gnu-tools-baremetal-practice's People

Contributors

carlogravador avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.