![]() Like vectors the default is to be conservative with memory use. ![]() The second and third sections show how you can control the allocate-ahead strategy for deque’s and strings. I have shown some commented out examples of how to change this strategy both for all vectors and just for vectors that contain a particular type (char in this example). The first section shows how you can influence how many places a vector allocates-ahead so that it has storage in the bank ready for future allocation requests. You only need to change the defaults if you want to influence the STL memory management strategy.Īll configuration options may be found in avr_config.h. For example, on my system I would copy all the header files into here: C:Program Files (x86)\arduino-1.0.1\hardware\tools\avr\avr\include. If you want to use the STL from within the popular Arduino IDE then all you need to do is copy all the files in the avr-stl/include directory into the hardware/tools/avr/avr/include subdirectory of the Arduino installation. Those of you that use Eclipse or a command line environment simply need to configure their compiler to reference the avr-stl/include directory. If you’re on the latest Arduino 1.0 (or more recent) IDE then you’ll need to download at least version 1.1 due to recent changes in the Arduino package detailed below. Users of the Arduino IDE should be careful to get the correct version. Simply download the zip file from my downloads page and unzip to a folder on your hard disk. The STL consists only of header files with all the source code inline. However I found that on the AVR platform, using the example on the uSTL webpage the code generated was 70% larger than that produced by the SGI STL so I feel somewhat justified in my choice. This one promised to eliminate the gcc bloat and so it had potential. This version was too well woven into the libstdc build to be easily extracted. Other versions that I considered were the GNU STL that ships built in to libstdc with gcc. These days most of the STL is a part of the Standard C library that ships with full-size C compilers. The STL has been around forever in computing terms with copyright notices appearing in the source code as far back as 1994 and is tried and trusted by C programmers the world over. Yes you did read that correctly, this post will present a port of the Standard Template Library, or STL as it’s more commonly known, to the AVR microcontrollers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |