GithubHelp home page GithubHelp logo

stapelzeiger / arm-cortex-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cvra/arm-cortex-tools

0.0 1.0 0.0 12 KB

Commonly used code for projects using ARM Cortex-M with ChibiOS

License: BSD 2-Clause "Simplified" License

C 92.35% Assembly 7.65%

arm-cortex-tools's Introduction

#MPU driver & Fault handler for Cortex-M4

##Requirements

  • ChibiOS
  • Cortex-M4 with Memory Protection Unit

##MPU Usage

By default the MPU prevents access to NULL pointer via memory region 7 (highest priority). Code execution from RAM is also disabled using lowest priority (memory region). To enable this you only have call mpu_init() to be protected.

You can then further restrict memory by using mpu_configure_region, e.g.:

    /* Disable code execution from RAM. */
    mpu_configure_region(6, /* Region number. */
                         0x2000 0000, /* Base address */
                         20, /* 1MB (2^20) */
                         AP_RW_RW,
                         false); /* Non executable. */

If you want to enable code execution from RAM you should add an executable region with higher priority (1-6).

##Fault Handler Usage

  • Implement void fault_printf(const char *fmt, ...) for logging.
  • Call fault_init() to enable the fault IRQs.

The file fault_tests.c contains functions to test the MPU and the fault handler.

Note: Depending on the CPU (Cortex-M3/M4 or Cortex-M0) you need to compile fault_v7m.s or fault_v6m.s

##License This code is released under a BSD license

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.