pw_allocator: Refactor Block to use encoded offsets

This CL refactors `Block` into `Block<UintType, kMaxSize>`. Instead of
using next and previous block pointers, it now encodes offsets and flags
in fields of type `UintType`. Depending on `kMaxSize`, there may be bits
of `UintType` that are not needed to address blocks. These bits are
available to be used as custom flags.

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