mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

MPU hal

MPU hal
[Hal]

The MPU hal provides a simple MPU API to enhance device security by preventing execution from ram. More...

Modules

 MPU hal tests
 

The MPU test validates proper implementation of the MPU hal.


Functions

void mbed_mpu_init (void)
 Initialize the MPU.
void mbed_mpu_enable_rom_wn (bool enable)
 Enable or disable ROM MPU protection.
void mbed_mpu_enable_ram_xn (bool enable)
 Enable or disable ram MPU protection.
void mbed_mpu_free (void)
 Deinitialize the MPU.

Detailed Description

The MPU hal provides a simple MPU API to enhance device security by preventing execution from ram.

# Defined behavior * The function mbed_mpu_init is safe to call repeatedly - Verified by mpu_init_test * The function mbed_mpu_free disables MPU protection - Verified by mpu_free_test * Execution from RAM results in a fault when execute never is enabled. This RAM includes heap, stack, data and zero init - Verified by mpu_fault_test_data, mpu_fault_test_bss, mpu_fault_test_stack and mpu_fault_test_heap. * Writing to ROM results in a fault when write never is enabled - Not verified

# Undefined behavior * Calling any function other than mbed_mpu_init before the initialization of the MPU.

See also:
MPU hal tests

Function Documentation

void mbed_mpu_enable_ram_xn ( bool  enable )

Enable or disable ram MPU protection.

This function is used to mark all of RAM as execute never. When enabled code is only allowed to execute from flash.

By default execution from RAM is disabled.

Parameters:
enabletrue to disable execution from RAM, false otherwise

Definition at line 223 of file mbed_mpu_v7m.c.

void mbed_mpu_enable_rom_wn ( bool  enable )

Enable or disable ROM MPU protection.

This function is used to mark all of ROM as read and execute only. When enabled writes to ROM cause a fault.

By default writes to ROM are disabled.

Parameters:
enabletrue to disable writes to ROM, false otherwise

Definition at line 211 of file mbed_mpu_v7m.c.

void mbed_mpu_free ( void   )

Deinitialize the MPU.

Powerdown the MPU in preparation for powerdown, reset or jumping to another application.

Definition at line 192 of file mbed_mpu_v7m.c.

void mbed_mpu_init ( void   )

Initialize the MPU.

Initialize or re-initialize the memory protection unit. After initialization or re-initialization, ROM and RAM protection are both enabled.

Definition at line 46 of file mbed_mpu_v7m.c.