Forum Discussion
Altera_Forum
Honored Contributor
14 years agoWhile technically possible, you'll need to write a lot of infrastructure to do this. Code overlays haven't been used much since 32bit address spaces and paged memory became common.
I'm not even sure the gnu linker will put multiple code blocks at the same physical adress, but at different virtual addresses. You might be better off trying to reduce the code size by ensuring everything is compiled with the optimiser (try -O2, -O3 and -Os, and possibly mark some functions as 'noinline'), reducing the use of libc (especially stdio and malloc) to the minimum. Even changes to the C source (eg careful use of local variables to avoid repeated memory accesses) can reduce the code size.