AN725
Rev. 0.1
13
section attribute tag to it.
__attribute__ ((__section__(".data.
name
")))
This tag will result in a warning indicating that code is being placed in the data section, but this warning can be
ignored. As an example, placing the PowerModes_2_or_6() function in RAM would look like:
__attribute__ ((__section__(".data.pm2_or_6")))
void PowerModes_2_or_6(void)
{
...
}
There are two ways to access the function in RAM: direct call or function pointer. Direct calls can cause some
issues with debugging the code in RAM, and the debugger may just step over the function instead of stepping into
it. To work around this, single step at the instruction level, set a breakpoint in the RAM code, or use a function
pointer.
To configure a device to run in PM1 or PM5:
1. Enable the clocks to peripherals that will be configured by firmware.
2. Select the desired clock source (LPOSC0, PLL0, etc.) and speed for both AHB and APB clocks.
3. Select the desired adaptive voltage scaling settings using the LDO module.
4. (Optional) Disable the retention mode of any enabled RAM banks.
5. Set the pins in the lowest power configuration for this mode.
6. Disable all unused peripherals.
7. Disable the clocks to all unused peripherals.
8. Jump to code in RAM.
9. (Optional) Disable the AHB clock to the flash controller.
To measure the data sheet numbers using an SiM3L1xx MCU Card and the AN725_PowerModes_1_and_5
example:
1. Configure the SiM3L1xx MCU Card according to the instructions in “5.2.1. Hardware Setup”.
2. Open the AN725_PowerModes_1_and_5 example in either Keil µVision or the Precision32 IDE.
3. Select the desired settings using the #defines at the top of the file. There is a set of defines for each data
sheet specification.
4. Compile and download the code to the device.
5. Disconnect the USB Debug Adapter.
6. Reset the device.
7. Measure the power consumption of the device.
The code executes from RAM in this mode, so all functions called should also be in RAM.