The section directive, and a carefully written linker script will let you assign different code and data to different memory areas.
You'll also need to consider how your code gets loaded.
If you are loading from the elf program image file (as the jtag loader does, and I do from an external processor) then you want the elf program headers to load all the sections to their physical addresses.
Some of the altera linker scripts (and their startup code) will append the initialised data for other sections onto the main code section, and have the startup code copy it into place! This doesn't work very well when your main code is 8k ands you have a 12k block of preinitialied data for a different data segment! Check with 'objdump -p' and by looking at the linkers .map output file.
If you are looking at code/data segments you may want to consider:
- using the 'small data segment' for things in tightly coupled memory.
- putting the 'rodata' into a data area (not with thge code).
- depending on your application, avoiding ALL of libc and not using the altera startup code (including the code that calls alt_main().
It is perfectly possible to do real things in a few kb of code.