"Jeffi Edward.J" <j.jeffi@xxxxxxxxxxx> writes: > Ian Lance Taylor-3 wrote: >> >> "Jeffi Edward.J" <j.jeffi@xxxxxxxxxxx> writes: >> >>> __sw_data_start = __code_end ; >>> __sw_data_end = __sw_data_start + 1000; /* using constant size 1000 may >>> leave hole or cause inadequate space (overlapping)for LMA of .data */ >> >> __sw_data_end = __sw_data_start + SIZEOF(.data); > > Thanks for the reply Ian. > I tried SIZEOF(.data) too. The GNU linker again reports error since the > .data section has not been defined at the calculation point. i.e again its a > forward reference. > > Have I missed something in my script so that SIZEOF() is not working? Please > suggest. Hmmm. That surprises me. But I would have to dig into the implementation so see why that is happening. I assume that you are using a reasonable recent version of the linker? If that doesn't work then I suppose I don't know if there is a good way to leave a hole the exact size of the .data section. Usually people don't care about that since the .data section comes at the end. Actually it comes at the end for you, too. I guess the reason you care is that you want to have the writable version of .data immediately follow the read-only version in the address space. Most people don't do that because the ROM and RAM are at different addresses anyhow. You may need to use a two-phase link. Do a normal link to get the size of the .data section, and then generate a linker script to do the link you want. Ian