Le 08/12/2010 13:51, Pierre-emmanuel a écrit :
> Hi all,
>
> I would like to share my experience (quite successful ;O) with MSP430X
> and MSPGCC with Cygwin 1.7.7.
> Please notice that I'm quite a new to MSPGCC and MSP430X, but this post
> may help other beginners.
> Along this post , you'll find some remaining questions, if you have any
> informations about theses or others, do not hesitate to share them.
>
> To get the compiler working on my cygwin with MSP430X extension, I've
> simply followed the the simple tutorial:
> http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Building_MSPGCC_from_Source_Code
> Downloading steps were very ok, but here are some remarks about
> compilation steps.
>
> 1) *** COMPILING BINUTILS ***
> cd binutils-2.19
> patch -p1< ../packaging/patches/binutils-2.19-patch
> ../configure --target=msp430 --prefix=/opt/msp430-X
> make
>
> ISSUE1: During compilation I got a "segmentation fault" with gcc on
> arparse.c compilation
> ==> I just removed (set to empty) the NO_WERROR variable inside the
> binutils/makefile.
>
> make install
>
>
> 2) *** COMPILING GCC MSP430X ***
> cp -av gcc/gcc-3.3/* gcc-3.2.3
> cd gcc-3.2.3
> ../configure --target=msp430 --prefix=/opt/msp430-z1
> make
>
> ISSUE2: Some of the source files (gcc-3.2.3/config.sub,
> gcc-3.2.3/config.gcc) were containing '\r' (0x15) char.
> ==> I just get ride of them with commands like:
> mv config.sub config.sub.old
> tr -d '\15'< config.sub.old> config.sub
> BUT notice that i found later that this issuecould have been solved
> inserting
> "set SHELLOPTS=igncr" inside "cygwin.bat" just after first line "@echo off"
>
> make install
>
> ISSUE3: When trying to make Install i got
> "*** No rule to make target `../libiberty/libiberty.a', needed by
> `gengenrtl..."
> ==> I had to recompile manually libiberty:
> cd libiberty
> make
> ...
> cd ..
>
> make install
>
>
>
> 3) *** COMPILING libc ***
> cd msp430-libc/src
> Think about modifying the Makefile:
> PREFIX = /opt/msp430.X
> And copy or link your freshly compiled "msp430-gcc.exe" to
> msp430/bin/gcc.exe
> then:
> make
> make install
> ISSUE4: On my side make install failed so I just did
> make install-multilib
>
> IMPORTANT NOTE: hardware multiplication is not well supported, hence
> think about compiling AND linking your futur source code with the
> option: "--mdisable-hwmul"
>
> <Q1> IS THERE ANY WORKS ON IMPROVEMENTS FOR MSP430X.( i.e. support of
> hardware multiplications, functions pointers etc ...) ? IS THE MSP430X
> BRANCH STILL ALIVE ?
>
>
> ISSUE5: To get a project correctly linked i had to comment all the
> source code inside "vuprintf()" function of "vuprintf.c", and recompile
> and re-install the libc ?
>
> <Q2> I'VE READ THAT THERE IS A PROBLEM WITH FUNCTION POINTERS ?
> There's a first comment about this here:
> http://comments.gmane.org/gmane.comp.hardware.texas-instruments.msp430.gcc.user/8993
> Thanks, but does any one now about a (future) correction in MSP430X ?
>
>
> ISSUE6: Even if compiled with "--mdisable-hwmul" option a source
> containing a logical shift left on long can't be linked :
> {
> long hi;
> ...
> hi<<= 1;
> ...
> }
> <Q3> PLEASE HELP FOR THIS ISSUE6 ?
>
>
> ISSUE7: As I have to use an F543xA mcu I had to import all the I/Os
> definition from msp430gcc 4.4.4 ! (merging MSP430X branch with mspgcc4
> would be nice !)
> mv /opt/msp430.X/msp430/include /opt/msp430.X/msp430/include.old
> cp -r /opt/msp430-gcc-4.4.4/msp430/include /opt/msp430.X/msp430/include
>
> <Q4> DO YOU SEE ANY RISK ABOUT THE SOLUTION TO THIS LAST ISSUE 7 ?
>
>
> ISSUE8: To get some flash access working
> Add #include "flash.h" inside include/msp430x54xx.h (coming from 4.4.4)
>
> Then, I could compile and upload small and "quite big" programs that use
> extended flash using
> __attribute__((__far__))
> And functions that are in far memory seem to work correctly.
>
> NOTE: I use "mspdebug 0.12" and the MSP43F543XA BSL with a flying camp
> dongle to upload software, That's nice. The only issue is the BSL
> activation sequence which, for MSP430F543XA, must be inverted on the
> TEST signal compared to the TI SLAU319a documentation.
>
> I have to do more tests now.
> But if any of you have any comments or other experience with MSP430.X
> please feedback.
>
> Regards
>
Hi,
Thanks "Pierre-emmanuel" for your post!
I use the MSP430X branch (MSPGCC3.2.3) sine a few months with MSP430F5418.
Some bugs are not solved at this time, but with some tips you can use
all the MCU memory space !
BUGS: far datas pointers, and far functions pointers are not supported !
So, I locate all my datas in the lower memory space ( below 64K ). Also,
I put too alls functions called by pointers.
Then the rest of code is located in the upper memory space with the
«FAR» attribute.
To do this, I use definitions in my common C-header (common.h).
I define this:
...
#if ( defined(__MSP430X2__) || defined(__MSP430X__) )
#ifndef __MSP430X_ADDR_16BIT__
#define far __attribute__((__far__))
#define __MSP430X_ADDR_20BIT__
#warning "use ADDR_20BIT"
#endif
#else
#endif
#if defined(__MSP430X_ADDR_20BIT__)
#define CODE far
#else
#define CODE
#endif
/* For assembly language */
#if defined(__MSP430X_ADDR_20BIT__)
#define _PUSH_ pushx.a
#define _POP_ popx.a
#define _RET_ reta
#define _CALL_ calla
#define _BR_ bra
#define _CODE_ASM_ .section ".fartext"
#else
#define _PUSH_ push.w
#define _POP_ pop.w
#define _RET_ ret
#define _CALL_ call
#define _BR_ br
#define _CODE_ASM_ .text
#endif
How to use it :
1) In C language
On my program, I declare my function like this:
CODE
void my_fucntion(void)
{
...
}
If I change addressing (16bis/20bis) with compiler option, functions are
located on the right place automaticaly !
Howerver be careful, with functions pointers! because the compiler store
only 16bits of the address, and the call is made with indirect access (
calla @R15) !
The function called is terminated by a «RETA». So the stack will be
corrrupt after the return !
Workaround : Don't use the standard writting !
I show you my example with an array of functions pointer :
#include "common.h"
...
#if defined(__MSP430X_ADDR_20BIT__)
void *Ptr = Hart_Ressource_Tab[id]._Hart_fnct_Read;
r = call_Hart_Ressource(ix_tx_data, ix_rx_data, 0, Ptr);
#else
# standard writting ...
r = Hart_Ressource_Tab[id]._Hart_fnct_Read(ix_tx_data, ix_rx_data, 0);
#endif
I use the « call_Hart_Ressource » function, like this
R15 = ix_tx_data
R14 = ix_rx_data
R13 = len
R12 = Ptr_fnct
...
#if defined(__MSP430X_ADDR_20BIT__)
unsigned char call_Hart_Ressource(unsigned char ix_tx_data, unsigned
char ix_rx_data, unsigned char len, void *Ptr_fnct)
{
#warning "Bug 20bits workaround! Function should be placed in lower
memory space !"
asm volatile(" calla R12");
}
#endif
...
2) In assembly language
Instead of writting standard instructions, replace it by the definitions
in common.h !
For section define:
.text/.section ".fartext" -> _CODE_ASM_
For some typicals instructions :
ret/reta -> _RET_
call/calla -> _CALL_
br/bra -> _BR_
push/pushx.a -> _PUSH_
pop/popx.a -> _POP_
Example on my sleep function :
#include "common.h"
.global Sleep
_CODE_ASM_
Sleep:
bic.b #HWD,&P_HWD_OUT; // port = 0
bis #CPUOFF,SR
nop ; zzz
bis.b #HWD,&P_HWD_OUT; // port = 1
_RET_
If someone find an other way to solve these problems or if you have more
tips, please post it !
Sorry for my poor English ;)
Regards, Thierry
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users