On Thu, May 7, 2020 at 12:21 PM Gregory Nutt <spudan...@gmail.com> wrote: > In the build, we build both user space code and internal OS code. > __KERNEL__, if defined means that we are currently building the internal > OS code. That allows the same files to be build differently depending > on if it is inside our outside the OS.
When doing a FLAT build, do we ever build nx_start.c twice, once with __KERNEL__ and once without? (In my configuration, it is built only once.) Regarding the code: /* Initialize the memory manager */ { FAR void *heap_start; size_t heap_size; #ifdef MM_KERNEL_USRHEAP_INIT /* Get the user-mode heap from the platform specific code and configure * the user-mode memory allocator. */ up_allocate_heap(&heap_start, &heap_size); kumm_initialize(heap_start, heap_size); #endif #ifdef CONFIG_MM_KERNEL_HEAP /* Get the kernel-mode heap from the platform specific code and * configure the kernel-mode memory allocator. */ up_allocate_kheap(&heap_start, &heap_size); kmm_initialize(heap_start, heap_size); #endif #ifdef CONFIG_MM_PGALLOC /* If there is a page allocator in the configuration, then get the page * heap information from the platform-specific code and configure the * page allocator. */ up_allocate_pgheap(&heap_start, &heap_size); mm_pginitialize(heap_start, heap_size); #endif } Is it always mandatory to do one of the three? Is it ever valid to do more than one of them? Based on the answers to those questions, I'd like to open a PR to check for invalid configuration here and output a compile-time #error. Cheers, Nathan