Need help regarding implementation of a library exactly like softdevice

Hello, I am working on Bluetooth mesh application and i am using nRF52832/40 for the development purpose.

I wants to create one independent library with its own data section in RAM, where main application will interact with this library and may use its data variables.

As Nordics soft-device already working like an independent library, Can you please help us with the implementation of soft-device?
How to initialize the ram section independently before execution of main application?
How to access the data variables from RAM section allocated for library?

Is there any documentation regarding soft-device implementation??