Вопрос

I'm using the MSPGCC to compile and link my programs. I'd like to see how the hardware addresses are assigned in the linker command file. Inside the header file for my device I found these lines:

/* 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

Further on in the file I found lines like this under the GPIO section:

SFR_8BIT(P1IN);                               /* Port 1 Input */
SFR_8BIT(P1OUT);                              /* Port 1 Output */
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */

What I'd like to see is how P1IN is defined. I'm trying to get a better understanding of what it is so I can use it.

I realize it can be used like this:

P1OUT &= 0xF7; // clear bit 3

I'd like to find the linker file so I can better understand how the address is being assigned. I know I can just look at the data sheet to see what it is, but I'd like to know how the linker is finding it.

Это было полезно?

Решение

They are defined in the file msp430g2553.cmd.

/************************************************************
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
************************************************************/
P1IN               = 0x0020;
P1OUT              = 0x0021;
...

PS: I'm using CCS. The file is located at path\to\ccs\ccs_base\msp430\include along with the header file msp430g2553.h.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top