This changes `memalign` (and `posix_memalign`) so that it uses an
allocation method with the same selection criteria (checking
`malloc_alwaysinternal_limit` and picking one of:
- always MALLOC_CAP_INTERNAL
- MALLOC_CAP_INTERNAL first with fallback
- MALLOC_CAP_SPIRAM first with fallback
`malloc_alwaysinternal_limit` is in turn set by the options
`CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL` and
`CONFIG_SPRIAM_USE_CAPS_ALLOC`.
This notably affects folks using esp-rs to build rust code for the
esp-idf, as all allocations from rust use `memalign`.
Merges https://github.com/espressif/esp-idf/pull/12375
portSTACK_TYPE is an internal macro defined by the porting layer. This commit
changes all references to StackType_t which is the official type exposed by
FreeRTOS.
This updates the minimal supported version of CMake to 3.16, which in turn enables us to use more CMake features and have a cleaner build system.
This is the version that provides most new features and also the one we use in our latest docker image for CI.