Commit Graph

18 Commits (f2c9d0c8107b0a67a3405d50451c79ada3d2d28b)

Author SHA1 Message Date
Kaspar Schleiser 8d88781e05 make: pkg: make use of PKGDIRBASE 7 years ago
Kaspar Schleiser 47f6ff3056 Merge pull request #6237 from kaspar030/rename_AD_to_Q
make: rename AD to Q
7 years ago
Kaspar Schleiser 79d2f9e574 pkg: tlsf: add license information 7 years ago
Kaspar Schleiser f44763f346 make: adapt Makefiles to AD -> Q rename 7 years ago
Oleg Hahm e443d3a0ff pkg tlsf: undefined left-shifting of neg. values 7 years ago
Oleg Hahm d4732952b2 pkg tlsf: add usage statistics 7 years ago
Kaspar Schleiser b3c5446209 pkg: tlsf: build in board directory 8 years ago
DipSwitch 0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 8 years ago
Kaspar Schleiser c63a924778 pkg: adapt to RIOTPKG 8 years ago
Oleg Hahm 3b5f1f949f pkg tlsf: use pkg directory for sources
The TLSF package was the only one using the $(BINDIR) instead of a subdirectory of pkg/. This commit changes this.
8 years ago
Martine Lenders 4dc851244d pkg: unify git paradigms for packages 8 years ago
Oleg Hahm a87927ed1a pkg tlsf: change URL for upstream TLSF archive 8 years ago
Oleg Hahm 60e283e6a2 pkg tlsf: add tlsf initialization function
The init function was patched out, but is actually required to compile without warnings with -pedantic enabled.

This patch also updates ccn-lite and x86 support accordingly.
8 years ago
Joakim Gebart 336a450106 pkg: Add .gitattributes to ignore whitespace errors inside some included patch files. 9 years ago
René Kijewski a70ee0f022 make: centralize wget/curl & unzip/7z feature test
With many open PRs that could benefit from loading SDKs when needed,
instead adding vast amounts of code to RIOTs master, this PR provides
the "functions" `$(DOWNLOAD_TO_STDOUT)`, `$(DOWNLOAD_TO_FILE)`, and

The first "function" takes one argument, the URL from where to download
the content. It is then piped to stdout. To be used e.g. with `tar xz`.

The second "function" taken two arguments, the destination file name,
and the source URL. If the previous invocation was interrupted, then the
download gets continued, if possible.

The last "function" takes one argument, the source ZIP file. The file
gets extracted into the cwd, so best use this "function" with
`cd $(SOME_WHERE) &&`.

The clumsy name `$(UNZIP_HERE)` is taken because the program "unzip"
takes the environment variable `UNZIP` as the source file, even if
another file name was given on the command line. The rationale for that
is that the hackers of "unzip" hate their users. Also they sacrifice
hamsters to Satan.
9 years ago
René Kijewski ee02a0f654 x86: fix download script for OSX
Mac OSX does not have `wget`, but `curl`.
It does not understand `tar xJ`, but `tar xj`.
9 years ago
René Kijewski 054f9fd026 make: fix clean together with TLSF 9 years ago
René Kijewski 88e8915dfe Add TLSF (two level segregated fit) PKG
This is my second take on #669, because I was asked to separate it from #764.

This change adds a malloc implementation as a PKG, which uses *TLSF* (two
level segregated fit).

The patch file removes the 64bit capatibilities, debug functions, and the
option to have multiple "control blocks" (a control block holds multiple
memory pools). It wraps `malloc()` and friends in `disableIRQ() … restoreIRQ()`.

The implemention does not support 16bit platforms, yet, but probably only some
constants would need fixing. I limited the maximum size of a memory pool to
2**30 bytes = 1GB.

This PKG is not meant to be used by applicitions directly, but by the boards.
The board's initialition code needs to call
`int tlsf_add_pool(void *mem, size_t bytes)` for every free memory region it
has. If the board in using newlib, then this call needs to happen before the
first call to `puts`, `printf`, and friends, because newlib allocates the
control data IO streams (stdin, stdout, stderr) on the heap. Adding a small
(e.g. 1kB) pool before proper board initialization would be a possible solution.

Please read the additional information in the website of the implementator,

> TLSF (two level segregated fit) is a relatively new memory
allocator designed for embedded systems. It boasts constant
time O(1) malloc/free response time and a 4-byte block
overhead. Though it typically is slightly slower than other
allocators such as dlmalloc, it has no worst-case behavior.

> The original implementation, which comes alongside the white
paper, is distributed under the GNU GPL/LGPL. The code found
here is an original implementation, released into the public
domain, therefore is not subject to any licensing restrictions.

> Features:
 -  O(1) cost for malloc, free, realloc, memalign
 -  Extremely low overhead per allocation (4 bytes)
 -  Low overhead per pool (~3kB)
 -  Low fragmentation
 -  Compiles to only a few kB of code and data

> Caveats:
 -  Currently, assumes architecture can make 4-byte aligned accesses
 -  Not designed to be thread safe; the user must provide this

> Known Issues:
Due to the internal block structure size and the implementation
details of tlsf_memalign, there is worst-case behavior when requesting
small (<16 byte) blocks aligned to 8-byte boundaries. Overuse of memalign
will generally increase fragmentation, but this particular case will leave
lots of unusable "holes" in the heap. The solution would be to internally
align all blocks to 8 bytes, but this will require significantl changes
to the implementation. Contact me if you are interested.
9 years ago