This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F6775A: SFR

Part Number: MSP430F6775A
Other Parts Discussed in Thread: MSP430F6775

Tool/software:

Hi,

I would like to ask there is the SFR with length 10 bytes in a linker file I have noticed that it is not use in a script. So why is it there cuz I have noticed that that address is not described in user guid or datasheet I have just found the SFR register and it starts from address 0x100. I have found this ag_04.pdf but don't know whether it is valid for this model or not. And also what is the connection between SFR and the macro in the header file :


#ifndef SFR_8BIT
/* External references resolved by a device-specific linker command file */
#define SFR_8BIT(address)   extern volatile unsigned char address
#define SFR_16BIT(address)  extern volatile unsigned int address
//#define SFR_20BIT(address)  extern volatile unsigned int address
typedef void (* __SFR_FARPTR)();
#define SFR_20BIT(address) extern __SFR_FARPTR address
#define SFR_32BIT(address)  extern volatile unsigned long address

#endif
How is this actually being resolved?
Thank you for your response!
  • Perhaps you are confusing two different things.

    The MSP430 has SFR registers, starting at 0x100, and described in the guide at 1.14. SFRIE1, etc. Then there are the SFR macros in the header files. Two different things.

  • Yes I know but that s why I am asking. Is the CMD version used somewhere or?

     How are those macros resolved ? I mean there is the whole peripheral file map. And I have seen also the approach with the you know *(char*) address so why use this instead :  

    SFR_16BIT(ADC12CTL0);                         /* ADC12+ Control 0 */
    SFR_8BIT(ADC12CTL0_L);                        /* ADC12+ Control 0 */
    SFR_8BIT(ADC12CTL0_H);                        /* ADC12+ Control 0 */
    SFR_16BIT(ADC12CTL1);                         /* ADC12+ Control 1 */
  • In GCC this is defined in iomacros.h, which gets included by msp430f6775.h

    #define sfr_b(x) extern volatile unsigned char x
    #define sfr_w(x) extern volatile unsigned int x
    #define sfr_a(x) extern volatile unsigned long int x
    #define sfr_l(x) extern volatile unsigned long int x
    
    

    Wrapped in a "#if defined(__ASSEMBLER__)...#else..." so that the same header file can be used with the assembler.

  • Hi Peter,

    I think this just the legacy format for whole 430 family.

    B.R.

    Sal

  • Hi,

    but it has no connection with the SFR in .cmd file or?

  • Hi Peter,

    Yes, it used for peripheral register access aperture.

    B.R.

    Sal

  • But here are the addresses from datasheet the SFR and the peripherals_8bit are there. What are they used for? Are they used somewhere else? Cuz according to .map file there is not a single register in that memory ranges. So are they used somewhere else or what are their purpose in the .cmd file?

  • Hi Peter,

    While it is not only for SFR (in cmd file), but also used for all other peripheral register, such as ADC, Timer module. These is not defined in cmd file.

    Below is ADC partial definition:

    cmd file normally define the FLASH/RAM and Interrupt vector, not define the peripheral map.

    B.R.

    Sal

**Attention** This is a public forum