Hello,
I develop on the MSP430F5418 and I use the MSP430X branch of MSPGCC3.
(binutils 2.19 / gcc3.2.3)
msp430-gcc -v give :
Configured with: ./configure --target=msp430
--prefix=/home/Utilisateur/mspgcc_100623/packaging/build/installed
--disable-libc --disable-libssp --disable-intl --disable-libiberty
--with-gcc --with-gnu-ld --with-gnu-as --with-stabs --disable-shared
--disable-threads --disable-win32-registry --disable-nls
--enable-languages=c,c++
Thread model: single
gcc version 3.2.3
1) 20-bit addressing code :
The CALLA / RETA instructions works. But be careful if you have written
assember routines.
You must change RET instruction by RETA!
Here are my compilation options:
-mdata-64k -ggdb -ffixed-r5 -ffixed-r6 -ffixed-r7 -O2 -Wall
(Optimization level: 2)
I put routines in assembler beyond 64K and it works, but I did not even
try with functions written in C.
2) 20-bit addressing data :
I had problems passing parameters (pointer type) to functions. And for
now I don't use it (-mdata-64k).
2-a) Example with «-mdata-64k»:
_FB_Bmp(_TEST4, 0, 0, 26, 160);
60e8: 30 12 a0 00 push #160 ;#0x00a0
60ec: 3c 40 1a 00 mov #26, r12 ;#0x001a
60f0: 0d 43 clr r13
60f2: 0e 43 clr r14
60f4: 3f 40 66 75 mov #30054, r15 ;#0x7566
60f8: b0 13 26 6c calla #0x06c26
...
char *_FB_Bmp(char *PtrBMP, _page_ P, _coordinate_ X, _page_ Dp,
_coordinate_ Dx)
{
6c26: 3b 15 pushm #4, r11
6c28: 04 15 pushm #1, r4
6c2a: 31 80 06 00 sub #6, r1 ;#0x0006
6c2e: 0a 4f mov r15, r10
6c30: 81 4e 00 00 mov r14, 0(r1) ;0x0000(r1)
6c34: 81 4d 02 00 mov r13, 2(r1) ;0x0002(r1)
6c38: 81 4c 04 00 mov r12, 4(r1) ;0x0004(r1)
6c3c: 14 41 14 00 mov 20(r1), r4 ;0x0014(r1)
...
Here the parameters list with registers / stack used:
Param 1 R15 : @_TEST4
Param 2 R14 : 0
Param 3 R13 : 0
Param 4 R12 : 26
Param 5 Stack : 160
_TEST4 is located in address : 0x7566
with «-mdata-64k» (26-bit addressing data) : It's works!
2-b) Example without «-mdata-64k»:
_FB_Bmp(_TEST4, 0, 0, 26, 160);
60e8: 30 12 a0 00 push #160 ;#0x00a0
60ec: 3c 40 1a 00 mov #26, r12 ;#0x001a
60f0: 0d 43 clr r13
60f2: 0e 43 clr r14
60f4: 3f 40 66 75 mov #30054, r15 ;#0x7566
60f8: b0 13 26 6c calla #0x06c26
...
char *_FB_Bmp(char *PtrBMP, _page_ P, _coordinate_ X, _page_ Dp,
_coordinate_ Dx)
{
6c26: 3b 14 pushm.a #4, r11
6c28: 04 14 pushm.a #1, r4
6c2a: 31 80 06 00 sub #6, r1 ;#0x0006
6c2e: 0a 4f mov r15, r10
6c30: 81 4e 00 00 mov r14, 0(r1) ;0x0000(r1)
6c34: 81 4d 02 00 mov r13, 2(r1) ;0x0002(r1)
6c38: 81 4c 04 00 mov r12, 4(r1) ;0x0004(r1)
6c3c: 14 41 14 00 mov 20(r1), r4 ;0x0014(r1)
...
So, the parameters passing are incorrect! the pointer does not address
high memory (0x0000 7566)!
3) The function pointers:
When I use function pointers, the compiler does not care about the high
memory address whatever the -mdata-64k.
With or without the code is the same:
typedef struct
{
void (* fnct_1)(void);
void (* fnct_2)(void);
} TPtrFnctionTest;
const TPtrFnctionTest PtrFnctionTest = {&Rien, &Rien};
00005eba <Rien>:
5eba: 10 01 reta
000060e0 <PtrFnctionTest>:
60e0: ba 5e ba 5e
the way I used to work around this problem is as follows:
typedef union
{
unsigned long dummy;
void (* fnct)(void);
} my_fnct;
typedef struct
{
my_fnct fnct_1;
my_fnct fnct_2;
} TPtrFnctionTest;
const TPtrFnctionTest PtrFnctionTest = {(my_fnct)&Rien, (my_fnct)&Rien};
00005eba <Rien>:
5eba: 10 01 reta
000060e0 <PtrFnctionTest>:
60e0: ba 5e 00 00
60e4: ba 5e 00 00
So, I can't use printf (in libc) because these function use function
pointer !
int vuprintf(int (*func)(int), const char *fmt0, va_list ap)
So here, the situation of the compiler !
Le 21/10/2010 11:53, Peter Bigot a écrit :
> mspgcc4 does not support more than 64KB of flash. You can probably
> hand-code calls; there should be instructions somewhere on the list
> archives, now available at
> http://www.mail-archive.com/[email protected]/
>
> Would somebody who has gotten the MSP430X branch of mspgcc3 to generate code
> for far text and/or data mind writing up a short how-to for the wiki?
>
> Peter
>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users