Cycle counter on ARM Cortex M4 (or M3)?

Take a look at the DWT_CYCCNT register defined here. Note that this register is implementation-dependent. Who is the chip vendor? I know the STM32 implementation offers this set of registers. This post provides instructions for using the DWT Cycle Counter Register for timing. (See the post form 11 December 2009 – 06:29 PM) This Stack … Read more

Fixed address variable in C

Your linker and compiler don’t know about that (without you telling it anything, of course). It’s up to the designer of the ABI of your platform to specify they don’t allocate objects at those addresses. So, there is sometimes (the platform i worked on had that) a range in the virtual address space that is … Read more

C++, can I statically initialize a std::map at compile time?

It’s not exactly static initialization, but still, give it a try. If your compiler doesn’t support C++0x, I’d go for std::map’s iteration constructor: std::pair<int, std::string> map_data[] = { std::make_pair(1, “a”), std::make_pair(2, “b”), std::make_pair(3, “c”) }; std::map<int, std::string> my_map(map_data, map_data + sizeof map_data / sizeof map_data[0]); This is pretty readable, doesn’t require any extra libraries and … Read more

Embedded C++ : to use STL or not?

I work on real-time embedded systems every day. Of course, my definition of embedded system may be different than yours. But we make full use of the STL and exceptions and do not experience any unmanageable problems. We also make use of dynamic memory (at a very high rate; allocating lots of packets per second, … Read more