Giter VIP home page Giter VIP logo

embappstartup's Introduction

embAppStartup

This is a minimal embedded application skeleton focusing on application startup and initialization, built for ARMv8A systems. It was tested on ARM FVP (fixed virtual platform) FVP_Base_RevC-2xAEMv8A.

It illustrated two ways to do scatter loading, which is the most important step for application startup and initialization:

  • Call ARM Library's startup code ARM Library's entry point is __main, which does scatter loading first, then call __rt_entry. After basic setup in the reset_handler, where it is appropriate to do scatter loading, make your code jump to __main:

    B __main

    Depending on what your application does, you may not need all other statrup implimentation done by __rt_entry. To override the __rt_entry from ARM Library, define your own __rt_entry, for example:

    //Override ARM library's __rt_entry:
        .global __rt_entry
        .type   __rt_entry @function
      __rt_entry:
      B  appmain

    which jumps to your application's main entry appmain directly. This is the recommended way for application startup and initialiation because of its robustness. No matter what kind of non-root regions you add and how many, ARM linker will automatically create a region table in the root region. The ARM Library function __main calls __scatterload, which goes through the region table and initialize the various execution-time regions:

    • Initialize ZI regions to zero
    • Copy RW data regions
    • Copy non-root RO regions
  • Ceate your own startup code for scatter loading You can also create your own scatter loading function if you don't want to depend on ARM Library. For each ZI region or non-root region, you need to add a section of initialization code. This is implemented by macros in this example project. If you add a new non-root region, do not forget to add its initialization in my__main (it's named so indicating it is the counterpart of __main) function. This is a drawback if this approach. ARM linker won't create a region table for you.

Build and run

the armclang toolchain is used to build this example. And the build script is CMake script. It's tested on ARM FVP FVP_Base_RevC-2xAEMv8A. Assuming your development environment is correctly set up, this is the steps to build:

  1. Creae a build directory: mkdir build
  2. CD to build: cd build.
  3. cmake ../ -DUSE_ARM_LIB_STARTUP=0
  4. cmake --build . -v

Hopefully, you'll get appStartupDemo.axf up to this point. The build option USE_ARM_LIB_STARTUP allows you to switch between the two initialization methods.

To run the FVP, use these model parameters:

-C bp.secure_memory=false -C bp.terminal_0.mode=raw -C bp.refcounter.non_arch_start_at_default=1

ARM FVP

The virtual platform used in this application is FVP_Base_RevC-2xAEMv8A, which can be downloaded here

embappstartup's People

Contributors

aohzju 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.