pw_allocator: Add MultiplexAllocator

This CL adds an allocator-like type that can multiplex between several
sub-allocators. If differs from the `Allocator` API in that each method
takes an additional token as a parameter.

These tokens are used to identify groups of memory requests and are
application-specific. This class facilitates mapping those tokens to
platform-specific allocators. This allows applications to use more
platform-agnostic dynamic memory, in turning allowing application reuse
across mutliple platforms, e.g. several generations of a product.

Change-Id: I6ba54d4e14a6f34fad2bf9920b50cfa3ba93d73c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/185027
Commit-Queue: Aaron Green <aarongreen@google.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
6 files changed
tree: c5a7266a7b552fbb48d6eb152430084126c47899
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. kudzu/
  7. pw_alignment/
  8. pw_allocator/
  9. pw_analog/
  10. pw_android_toolchain/
  11. pw_arduino_build/
  12. pw_assert/
  13. pw_assert_basic/
  14. pw_assert_log/
  15. pw_assert_tokenized/
  16. pw_assert_zephyr/
  17. pw_async/
  18. pw_async2/
  19. pw_async2_basic/
  20. pw_async_basic/
  21. pw_base64/
  22. pw_bloat/
  23. pw_blob_store/
  24. pw_bluetooth/
  25. pw_bluetooth_hci/
  26. pw_bluetooth_profiles/
  27. pw_bluetooth_sapphire/
  28. pw_boot/
  29. pw_boot_cortex_m/
  30. pw_build/
  31. pw_build_info/
  32. pw_build_mcuxpresso/
  33. pw_bytes/
  34. pw_checksum/
  35. pw_chre/
  36. pw_chrono/
  37. pw_chrono_embos/
  38. pw_chrono_freertos/
  39. pw_chrono_rp2040/
  40. pw_chrono_stl/
  41. pw_chrono_threadx/
  42. pw_chrono_zephyr/
  43. pw_cli/
  44. pw_compilation_testing/
  45. pw_console/
  46. pw_containers/
  47. pw_cpu_exception/
  48. pw_cpu_exception_cortex_m/
  49. pw_crypto/
  50. pw_digital_io/
  51. pw_digital_io_mcuxpresso/
  52. pw_digital_io_rp2040/
  53. pw_docgen/
  54. pw_doctor/
  55. pw_emu/
  56. pw_env_setup/
  57. pw_file/
  58. pw_format/
  59. pw_function/
  60. pw_fuzzer/
  61. pw_hdlc/
  62. pw_hex_dump/
  63. pw_i2c/
  64. pw_i2c_linux/
  65. pw_i2c_mcuxpresso/
  66. pw_ide/
  67. pw_interrupt/
  68. pw_interrupt_cortex_m/
  69. pw_interrupt_xtensa/
  70. pw_interrupt_zephyr/
  71. pw_intrusive_ptr/
  72. pw_kvs/
  73. pw_libc/
  74. pw_libcxx/
  75. pw_log/
  76. pw_log_android/
  77. pw_log_basic/
  78. pw_log_null/
  79. pw_log_rpc/
  80. pw_log_string/
  81. pw_log_tokenized/
  82. pw_log_zephyr/
  83. pw_malloc/
  84. pw_malloc_freelist/
  85. pw_malloc_freertos/
  86. pw_metric/
  87. pw_minimal_cpp_stdlib/
  88. pw_module/
  89. pw_multibuf/
  90. pw_multisink/
  91. pw_package/
  92. pw_perf_test/
  93. pw_persistent_ram/
  94. pw_polyfill/
  95. pw_preprocessor/
  96. pw_presubmit/
  97. pw_protobuf/
  98. pw_protobuf_compiler/
  99. pw_random/
  100. pw_result/
  101. pw_ring_buffer/
  102. pw_router/
  103. pw_rpc/
  104. pw_rpc_transport/
  105. pw_rust/
  106. pw_snapshot/
  107. pw_software_update/
  108. pw_span/
  109. pw_spi/
  110. pw_spi_mcuxpresso/
  111. pw_status/
  112. pw_stm32cube_build/
  113. pw_stream/
  114. pw_stream_shmem_mcuxpresso/
  115. pw_stream_uart_linux/
  116. pw_stream_uart_mcuxpresso/
  117. pw_string/
  118. pw_symbolizer/
  119. pw_sync/
  120. pw_sync_baremetal/
  121. pw_sync_embos/
  122. pw_sync_freertos/
  123. pw_sync_stl/
  124. pw_sync_threadx/
  125. pw_sync_zephyr/
  126. pw_sys_io/
  127. pw_sys_io_ambiq_sdk/
  128. pw_sys_io_arduino/
  129. pw_sys_io_baremetal_lm3s6965evb/
  130. pw_sys_io_baremetal_stm32f429/
  131. pw_sys_io_emcraft_sf2/
  132. pw_sys_io_mcuxpresso/
  133. pw_sys_io_rp2040/
  134. pw_sys_io_stdio/
  135. pw_sys_io_stm32cube/
  136. pw_sys_io_zephyr/
  137. pw_system/
  138. pw_target_runner/
  139. pw_thread/
  140. pw_thread_embos/
  141. pw_thread_freertos/
  142. pw_thread_stl/
  143. pw_thread_threadx/
  144. pw_thread_zephyr/
  145. pw_tls_client/
  146. pw_tls_client_boringssl/
  147. pw_tls_client_mbedtls/
  148. pw_tokenizer/
  149. pw_tool/
  150. pw_toolchain/
  151. pw_toolchain_bazel/
  152. pw_trace/
  153. pw_trace_tokenized/
  154. pw_transfer/
  155. pw_unit_test/
  156. pw_unit_test_zephyr/
  157. pw_varint/
  158. pw_watch/
  159. pw_web/
  160. pw_work_queue/
  161. seed/
  162. targets/
  163. third_party/
  164. ts/
  165. zephyr/
  166. .bazelignore
  167. .bazelrc
  168. .black.toml
  169. .clang-format
  170. .clang-tidy
  171. .eslintrc.cjs
  172. .git-blame-ignore-revs
  173. .gitattributes
  174. .gitignore
  175. .gn
  176. .mypy.ini
  177. .prettierignore
  178. .prettierrc.cjs
  179. .pw_ide.yaml
  180. .pylintrc
  181. activate.bat
  182. Android.bp
  183. AUTHORS
  184. bootstrap.bat
  185. bootstrap.sh
  186. BUILD.bazel
  187. BUILD.gn
  188. BUILDCONFIG.gn
  189. CMakeLists.txt
  190. jest.config.ts
  191. Kconfig.zephyr
  192. LICENSE
  193. modules.gni
  194. OWNERS
  195. package-lock.json
  196. package.json
  197. pigweed.json
  198. PIGWEED_MODULES
  199. README.md
  200. rollup.config.js
  201. tsconfig.json
  202. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links