Development release 20120425 of mspgcc is now available. This is a development release. It begins the path to 20-bit support by adding int20_t and uint20_t: these are implemented under the covers by a new type attribute __a20__ which indicates that the 32-bit type it attaches to maintains only 20 bits of precision, uses a single 20-bit register, but two words when placed in memory. It is available via <stdint.h> when compiling with -mcpu=430x (which is implied by any -mmcu option that identifies a 430X CPU).
The purpose of this type is primarily to simplify validation of the sorts of operations that will be needed for 20-bit pointers, but it may also come in handy when a little extra precision is required. An example of use: #include <inttypes.h> #include <stdio.h> uint16_t vals[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x8001, 0x8002, 0x8002, 0x8004, 0x8005, 0xf000 }; void main (void) { int i; uint20_t sv; sv = 0; for (i = 0; i < sizeof(vals)/sizeof(*vals); ++i) { sv += vals[i]; printf("Add %04" PRIx16 " produces %05" PRIx20 "\n", vals[i], sv); } } Add 0001 produces 00001 Add 0002 produces 00003 Add 0003 produces 00006 Add 0004 produces 0000a Add 0005 produces 0000f Add 0006 produces 00015 Add 0007 produces 0001c Add 0008 produces 00024 Add 0009 produces 0002d Add 8001 produces 0802e Add 8002 produces 10030 Add 8002 produces 18032 Add 8004 produces 20036 Add 8005 produces 2803b Add f000 produces 3703b (Careful experimenters will notice that the generated code in this case includes unnecessary register moves. Should somebody care to document this in a ticket, I'll try to take a look; at the moment, correctness is what I'm after, and speed can follow at a later time.) More examples are in the mspgcc repository in the tests/master branch. Companion to attribute __a20__ is a pair of function attributes __sr16__ and __sr20__, which cause any callee-saved registers within the function to be preserved to 16 (default, historical) or 20 (new) bits. As a general rule (but not enforced), if you are using __a20__ values you'll want to add -msr20 to your compiler flags so that the values aren't clobbered in function calls (including interrupts). Finally, this release introduces the mechanism by which compilation features can be identified within the source at compile-time. The __MSP430X__ preprocessor symbol, historically defined only for CPUX-compatible MCUs, now contains the same value as __MSP430_CPU__ but also encodes bits indicating CPUX-related compilation features. For example: #if __MSP430X__ & __MSP430_CPUX_FEATURE_SR20__ pushm.a #2, r11 #elif __MSP430X__ pushm #2, r11 #else /* CPUX */ push r11 push r10 #endif /* CPUX */ A persistent version of the above documentation, as well as an outline of the similar attributes and compiler options that will enable use of 20-bit values as pointers, will be appearing on the mspgcc wiki over the next week or so. The patch bundle for 20120425 is available at: https://sourceforge.net/projects/mspgcc/files/mspgcc/DEVEL-4.7.x The tag workspace/release/20120425 in git://mspgcc.git.sourceforge.net/gitroot/mspgcc/mspgcc checks out a workspace configured for this release. The tag workspace/master checks out a workspace configured for the development series. Downstream packagers: please don't bundle this. It's so experimental, only people who are build from source should be playing with it. The stable series remains LTS-20120406. As usual, please submit problems as tracker tickets at: https://sourceforge.net/tracker/?group_id=42303&atid=432701 Summary of changes in mspgcc release 20120425 since release 20120407 binutils: no changes gcc: changes from gcc-4.7.0-20120407 to gcc-4.7.0-20120425: - 5ff0c47 [2012-04-25 03:36:18 -0500] Update DEV-PHASE for release - 150e88f [2012-04-24 14:48:07 -0500] Anticipatory patch for PR middle-end/53104 - 086a2c8 [2012-04-24 13:54:22 -0500] Anticipatory patch for PR middle-end/53103 - 519cc89 [2012-04-11 18:10:41 -0500] Anticipatory patch for PR middle-end/52940 - 770d836 [2012-04-09 17:29:18 -0500] Anticipatory patch for PR middle-end/52919 - cdf7d6e [2012-04-03 16:44:16 -0500] Anticipatory patch for PR middle-end/52856 - cffacc3 [2012-04-25 02:31:46 -0500] Update for release - fcf6556 [2012-04-23 17:40:08 -0500] Support extend from psi, and truncate to/from psi - c9c18ad [2012-04-24 13:56:32 -0500] Support zero-extend load byte into PSI as well as HI reg - a0a3396 [2012-04-10 17:29:34 -0500] SF 3512818 rework rotate to use 430x repeat feature - fccc558 [2012-04-09 20:12:20 -0500] Support shift to PREC-1 for PSImode - 1e49a19 [2012-04-11 11:14:37 -0500] Add CPUX repeated instruction support - 13e444c [2012-04-08 11:42:29 -0500] Support saving 20-bit registers within functions - fad4a26 [2012-04-03 12:35:29 -0500] Partially working support for a20 comparisons - 2e42b9f [2012-04-03 09:36:53 -0500] Correct instruction lengths for extended instructions - f67b68c [2012-04-03 08:11:05 -0500] Incomplete support for passing a20 args around in functions - 64b825f [2012-04-02 17:59:55 -0500] Add PSImode as 20-bit integer via __a20__ attribute on long int - 926fe46 [2012-04-02 14:55:47 -0500] Uniformly use TARGET_CPUX when mcu has CPUX support gdb: no changes msp430-libc: changes from msp430libc-20120224 to msp430libc-20120425: - f7aa387 [2012-04-25 02:41:38 -0500] Regenerate - 5503065 [2012-04-25 02:41:38 -0500] Update version number and release notes - 3904c1d [2012-04-08 15:13:10 -0500] Add -msr20 recognition to assembly sources - 5851e48 [2012-03-06 08:54:22 -0600] Add int20_t support msp430mcu: changes from msp430mcu-20120407 to msp430mcu-20120425: - efd322e [2012-04-25 02:42:37 -0500] Regenerate - 56f216c [2012-04-25 02:42:30 -0500] Update version number and release notes - c4cde23 [2012-04-03 09:53:36 -0500] Add __a20__ to 20-bit peripheral register declarations ------------------------------------------------------------------------------ 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