Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CPU MPU Example 1 for EVK1100 Documentation

Introduction

This is the documentation for the data structures, functions, variables, defines, enums, and typedefs for the MPU driver.
It also gives an example of the usage of the MPU module.

The MPU allows the user to divide the memory space into different protection regions. These regions have a user-defined size and start at a user-defined address. The different regions can have different access privileges attributes.

You can also read the Memory Protection Unit section in the AVR32 UC technical reference guide.

Example Description

  • The memory areas are set up in the following manner:
    Access permissions of used memory areas
    Memory Range Access Permissions
    RAM [0x00000000 - 0x00000F00[, Region 1, subregions 0 to 14 Read / Write
    RAM [0x00000F00 - 0x00001000[, Region 1, subregion 15 Read
    Stack [&stack - &stack + stack size[, Region 2, all subregions Read / Write
    Flash [0x80000000 - 0x8000C000[, Region 0, subregions 0 to 11 Read / eXecute
    Flash [0x8000C000 - 0x80010000[, Region 0, subregions 12 to 15 Read
    PBA memory map[0xFFFF0000 - 0xFFFFFFFF], Region 3, all subregions Read / Write
  • The application then performs a write access to Region 1/subregion 15. That triggers a DTLB write protection exception => MPU_STATE changes to DTLB_WRITE_EXCEPTION and LED3 lights up.
  • The application then calls a function in Region 0/Subregion 12. That triggers an ITLB protection exception => MPU_STATE changes to ITLB_PROTECTION_EXCEPTION and LED2 lights up.
  • End of example: LED0 & LED1 alternatively blink forever.

Main Files

  • mpu.c: MPU driver
  • mpu.h: MPU driver header file
  • mpu_example1.c: MPU example
  • mpu_exception.S: asm file for exception support (GCC)
  • mpu_exception.s82: asm file for exception support and declaration of function specially located (IAR)

Compilation Info

This software was written for the GCC for AVR32 and IAR Embedded System Workbench for AVR32.

Information

This example has been tested with the following configuration:

  • EVK1100, EVK1101, EVK1104, EVK1105, UC3L_EK, UC3C_EK, UC3-A3 XPLAINED, UC3-L0 XPLAINED boards.
  • CPU clock: 16MHz in UC3C_EK and 12 MHz in all other boards.
  • PC terminal settings:
    • 57600 bps,
    • 8 data bits,
    • no parity bit,
    • 1 stop bit,
    • no flow control.

Contact Information

For further information, visit Atmel AVR UC3.