Hi Experts,
The well optimized hardware functionality could be messed up by the poor software programming.
Is there any general guidelines recommended by ARM on the power optimized programming ?
Regards,
Techguyz
I know I'm not an ARM employee, but don't forget to use WFI and WFE, when your code is doing nothing (eg. if it's waiting for something to happen, including a completed DMA transfer).
Setting up a timer and attaching a DMA to transfer data at a specific rate (or memory-to-memory copy) and enabling a completion interrupt might also be useful, depending on your application. Use WFI to put the processor to sleep while your data is being copied/transferred (unless you have tasks that can be done while data is being copied/transferred).
On rare occasions you might benefit from putting a WFI inside a low-priority interrupt.
I've been speaking and lecturing about this for quite a few years now - glad to hear the message may be getting through!
Here is an article I wrote for EETimes a few years ago: http://www.eetimes.com/document.asp?doc_id=1279523
Follow the link in the article for a complete PDF of the paper.
And here is another one on how to use interrupts efficiently on Cortex-M microcontrollers. This one comes from Embedded World earlier this year.
http://www2.keil.com/docs/default-source/default-document-library/01_shore_arm.pdf?sfvrsn=2
Chris
Oh, I forgot a very important thing: Turn off all the peripherals you do not use.
Some microcontrollers allow you to turn on a peripheral, change settings and turn it off, then they keep their settings. Investigate if you have such peripherals.
I don't know if there is a document about the information you are looking for from ARM. The list below may help. These are not directly from ARM but most of the resources are intended for ARM architecture or primarily for ARM architecture.
From Beningo Engineering / jacobbeningo
From Freescale Semiconductor
From Mentor Graphics
Nucleus (the first embedded RTOS with built-in Power Management Framework) Power Management page
http://www.mentor.com/embedded-software/nucleus/power-management
colinwalls Blog Post
Articles about power management and RTOS memory utilization
From embedded.com, Colin Walls
Power management in embedded software
goodwin wrote: I don't know if there is a document about the information you are looking for from ARM.
goodwin wrote:
I don't know if there is a document about the information you are looking for from ARM.
Well, chrisshore is from ARM and he wrote two great documents on the subject, I highly recommend them.
The list below may help.
I'd like to add this from STMicroelectronics, which is highly relevant; it targets the STM32L4 series:
If you are using a different device, try going to the manufacturers web-site and find information about what energy-efficient features this particular device has.
-Also be sure to follow Chris, and make sure you attend an event if he's coming to your area.
Thanks for the upvote, jensbauer! Power efficient programming is a tricky area and it is not widely understood in the industry. It deserves a lot more attention than it gets.
For any who are interested in face-to-face events (a great way to pick up best practice and share experiences), my next engagements are Trondheim Developer Conference in October (here), the ARM Technical Symposium in Bangalore (also in October, here) and then at ARM TechCon in Santa Clara in November (here). Would be great to be able to meet up with any of the community who can attend any of those events. Do let me know if any of you have plans to attend.
pravinchanm: It's important to get the foundation right as the very first thing, thus if following Chris' documents, you'll cover the largest area of energy saving.
When you're sure you've absorbed and implemented your code the way Chris explains, and you still need to save further energy, it's time to consult the chip vendor's documents on the subject.
Chris: I really wish I could go to Trondheim; the Memory Access Ordering sounds like it's just for me. I get the impression that it will touch the Cortex-M7 too.
pravinchanm: This topic reminds me that it's important to also optimize your data if you can. Arrange your data in memory, so fetching, using and storing them will cost as little CPU cycles as possible. You know, optimizing isn't all about optimizing code, but it's also about optimizing your data by arranging them correctly, even swapping bits if possible/necesasry.
A few articles and other resources you might consider
10 tips for maximizing battery life | EDN
There is also a free session I did as part of an ARM series for DesignNews CEC that you can find at the link below:
Design News CEC – Mastering the ARM Cortex-M Processor | Beningo Engineering
Session 5 is on low power design fundamentals
For application software just optimize for performance - as a first order approximation faster code is generally more energy efficient (and there are LOTS of tools to help writing fast code).
That should include looking at techniques such as multi-threading - running 4 parallel threads at a slower clock speed on 4 "LITTLE" cores may be a lot more efficient than running one thread at a high clock speed on a "big" core. Higher frequencies need higher voltages, and energy per FLOP/IOP is proportional to V squared, so even in a system without big.LITTLE this advice applies, big.LITTLE just amplifies the effect.
HTH, Pete
> Well, Chris Shore is from ARM and he wrote two great documents on the subject, I highly recommend them.
I agree. I just thought what pravinchanm is exactly looking for from ARM is a document consolidating the ideas and techniques about programming for energy efficiency. I'm not aware if there is any so I just added some information which may be helpful although these also belong to the inventory of fragmented materials.
> I'd like to add this from STMicroelectronics, which is highly relevant; it targets the STM32L4 series:
> ...
The readers should not interpret our lists of App Notes as endorsement of specific manufacturer. In my case those were just the quickest I can recall, in fact I didn't have the URLs for the Freescale documents, only the home page. The STM32 Discovery and Nucleo are among my arguments against investing in more expensive 8-Bit boards.
> Chris: I really wish I could go to Trondheim; the Memory Access Ordering sounds like it's just for me...
>
> techguyz: This topic reminds me that it's important to also optimize your data if you can...
Right. It's overlooked. Nowadays, I don't care to defragment my hard disks.
In tightly constrained systems, where ARM is commonly found, the arrangement of data could bring striking impact to various facets of performance.