3.7 Custom Runtime Startup Code

Custom runtime startup code that assumes single, contiguous data or bss regions will not work as expected.

Description

In order to clear or initialize all the object and RAM function sections at runtime, the linker creates a data-initialization template that is loaded into an output section named .dinit and allocated in program memory. The start-up module interprets this template and writes or copies initial values into the required sections. There can be multiple non-contiguous sections present.

Migration

There is no option or code feature to directly control how MPLAB XC8 structures the runtime startup code. If control of the data initialization process is critical to your application, a linker script that maps all the .data and .bss sections would be necessary to ensure that the best-fit allocator utilized by MPLAB XC8 does not allocate them. See also Link Order for more information on changing the linker script.