Use '-mmemory-model=large' instead of the underlying flags and your code should work. (In fact, use -mmemory-model=medium unless you need code in far memory: due to limitations in gcc that I've mentioned before certain optimizations get disabled when sizeof(void*) != sizeof((*)(void)), which only holds when -md20 != -ma20.)
As it turns out, though my intent was that compilation would be determined solely by the -mX20 flags, the text of https://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Gcc47:20-Bit_Design#memmodel is partially correct in its statement that if you leave the default memory model at "none", everything is assumed to be 16-bit. There is exactly one use of the -mmemory-model flag in mspgcc, and what that use does is force data into the default region. I'm not sure yet whether this is going to be a bug or a documentation change. It's now recorded as 3562647 for future review. Peter On Tue, Aug 28, 2012 at 11:33 PM, Shalabh Jain <shalabh.j...@gmail.com> wrote: > Hi, > > I recently installed the 20120716 release (following the instructions in > the readme and wiki). The installation seems fine as I can compile and > correctly run the my code from v4.6. > > My chip is msp430f5438a on the experimenter board. > > I would like to put a lookup table in the far memory region. I was testing > some simple code using the __far__ attribute, but the code seems to be > getting placed in the near region. I'm sure I'm missing something silly. > Can somebody please help. (Note: The code is not mean to produce anything > meaningful. I simply need to see if the memory assignment is happening > correctly, for which I am using msp430-objdump > > My sample code > > #include <stdio.h> > #include "sj.h" > /* contains an initialized array declared as > const char kuttest[30000] __attribute__((__far__)) = > { 1, \ > 2, \ > 2, \ > 2, \ > 2, \ > 2, \ > ... > }; > > int putchar(int c) {return 0;} > > void main() { > int res; > const char * __attribute__((__a20__)) abc = kuttest; > for(res = 0; res < 10; res++) > printf("%x abc", *(abc+res)); > } > > I am compiling this will the most conservative options > msp430-gcc-4.7.0 -mmcu=msp430f5438a -md20 -msr20 -mdata-region=far -mc20 > -mcode-region=far fardata.c -Wall -o fardata > > The code compiles fine (with the warning about main return type not being > int). > The objectdump shows me > > Disassembly of section .rodata: > > 000066d6 <kuttest>: > 66d6: 01 02 mova #4, r1 ;r2 As==10 > 66d8: 02 02 mova #4, r2 ;r2 As==10 > 66da: 02 02 mova #4, r2 ;r2 As==10 > 66dc: 02 02 mova #4, r2 ;r2 As==10 > 66de: 02 02 mova #4, r2 ;r2 As==10 > 66e0: 02 02 mova #4, r2 ;r2 As==10 > 66e2: 02 02 mova #4, r2 ;r2 As==10 > 66e4: 02 02 mova #4, r2 ;r2 As==10 > > The variable is not in the far address space. > > Any help is appreciated. > > Thanks a lot > > Shalabh > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users