maybe this makes sense by way of an example, I dont have a pic compiler handy but it doesnt matter with respect to the question.
Take this code
unsigned int xyz=5;
unsigned int fun ( unsigned int x )
Compile it, assemble and link. Then disassemble to show the result of that
Disassembly of section .text:
0: e3a0d902 mov sp, #32768 ; 0x8000
4: eb000000 bl c <fun>
8: eafffffe b 8 <_start+0x8>
c: e59f3008 ldr r3, [pc, #8] ; 1c <fun+0x10>
10: e5933000 ldr r3, [r3]
14: e0800003 add r0, r0, r3
18: e12fff1e bx lr
Disassembly of section .data:
So we have a global variable xyz, this is data, this goes in ram, we can read and write it, change its value, whatever, it has to be in read/write ram.
The program which is the machine code basically is from address 0x00000000 to 0x0000001F above.
So program memory also known as .text is the program the instructions. Data memory also known as .data is the read/write variables in particular ones like this that are pre-initialized to some value. Ones that are not initialized to some value fall into the .bss segment but are still in ram since they are read/write variables.
When the microcontroller is off, ram is off, it doesnt work it cannot store values. EEPROM and FLASH and other forms of nonvolatile memory are used. The processor/hardware is designed to know how to start using that memory and the programs are designed to operate from that memory. You can see we have an issue, we need to remember that the variable xyz needs to start with the value 5, but ram is volatile. So we need to have in non volatile memory both the program itself and any other items that we need to know. So all of .text and in the case of a microcontroller generally the program is executed from on chip flash and is accessed by the microcontrollers processor at the addresses we have linked. The .data values I have not shown the bootstrap magic here, but the bootstrap that runs before the entry point C function (usually main but that is arbitrary) has a few jobs minimum to do. first is set the stack pointer so we have a stack, normally the processor core does not know how much ram there is so the software does it. Second it needs to copy any .data values to ram so that the C program can find them, so in this case the value 0x00000005 will be somewhere in flash and we will know we have to copy that value to address 0x20000000 in ram. Third and not necessarily in this order, there will be address and size information for .bss, I dont have any bss variables in this example, but if there were we would have a starting address and number of bytes information that we would then have bootstrap code to zero out as programmer sometimes assume that a variable without a value assigned at compile time will be zero if they read it before they write it.
So data memory is the ram, I assume from your output that it is telling you how many bytes of variables the compiler has detected your program needs. The program memory is the program itself the machine code. Flash which you didnt ask about will hold the program memory and information about the data memory so your program can work. And then there is EEPROM, which is another form of non-volatile memory where you can save some items. often accessed through a library or code you write but not normally accessed as a simple variable name nor executed through as a program (in a microcontroller). Say your device is an mp3 player and the music is also in the flash perhaps in the form of a file system with files. You might want to add the feature that when the device is turned off, the last file being played and where in that file be saved so that when the power comes back it can continue. You could store this information in ram and have the battery in the device keep the ram alive, or you can store it in flash if there is space, or you can store it in EEPROM if your device has EEPROM. You would often use EEPROM for runtime information that you want to preserve through a power cycle. Like the odometer reading on a car, even if the battery is disconnected you want to remember the mileage for the car, so that when it is up and running again you can continue from that value and not start from zero every time. remember the users radio station preferences for shortcut buttons.