Skip to content

Commit 9bd814a

Browse files
committed
Add pinmap docs to target porting summary page
Add information on creating pinmaps for new targets in the porting page.
1 parent cd7cc90 commit 9bd814a

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

docs/porting/target/target.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,42 @@ Add the target description to `mbed-os\targets\targets.json` using keys that the
3636

3737
### HAL porting
3838

39-
There are many more APIs to implement. You enable the following APIs by adding a `device_has` attribute to the MCU_NAME target definition in `targets.json` and providing an implementation of the API declared in the API header.
40-
41-
device_has | API header
42-
-----------------|------------------
43-
ANALOGIN | analog_in.h
44-
ANALOGOUT | analog_out.h
45-
CAN | can_api.h
46-
EMAC | emac_api.h
47-
INTERRUPTIN | gpio_irq_api.h
48-
I2C I2CSLAVE | i2c_api.h
49-
LPTICKER | lp_ticker_api.h
50-
LPTICKER | lp_ticker_api.h
51-
MPU | mpu_api.h
52-
PORT_IN PORT_OUT | port_api.h
53-
PWMOUT | pwmout_api.h
54-
RTC | rtc_api.h
55-
SLEEP | sleep_api.h
56-
SPI SPISLAVE | spi_api.h
57-
TRNG | trng_api.h
58-
FLASH | flash_api.h
39+
There are many more APIs to implement. You enable the following APIs by adding a `device_has` attribute to the MCU_NAME target definition in `targets.json` and providing an implementation of the API declared in the API header along with supplying a pinmap.
40+
41+
device_has | API header | Pinmaps
42+
-----------------|----------------------|------------------
43+
ANALOGIN | analog_in.h | PinMap_ADC
44+
ANALOGOUT | analog_out.h | PinMap_DAC
45+
CAN | can_api.h | PinMap_CAN_TD/RD
46+
EMAC | emac_api.h | N/A
47+
INTERRUPTIN | gpio_irq_api.h | N/A
48+
I2C I2CSLAVE | i2c_api.h | PinMap_I2C_SDA/SCL
49+
LPTICKER | lp_ticker_api.h | N/A
50+
LPTICKER | lp_ticker_api.h | N/A
51+
MPU | mpu_api.h | N/A
52+
PORT_IN PORT_OUT | port_api.h | N/A
53+
PWMOUT | pwmout_api.h | PinMap_PWM
54+
RTC | rtc_api.h | N/A
55+
SLEEP | sleep_api.h | N/A
56+
SPI SPISLAVE | spi_api.h | PinMap_SPI_SCLK/MOSI/MISO/SSEL
57+
QSPI | qspi_api.h | PinMap_QSPI_SCLK/SSEL/DATA0-3
58+
TRNG | trng_api.h | N/A
59+
FLASH | flash_api.h | N/A
60+
61+
### Pinmap
62+
63+
Pinmap information is added by creating a `PinMap` array which consists of a pin name, a peripheral and a function. The end of the pin map array is indicated by the presence of a NC pin. By convention a target's pinmap is defined in target specific file named PeripheralPins.c with a name matching that in the above table. An example of this for a UART TX pinmap is shown below:
64+
65+
```C
66+
const PinMap PinMap_UART_TX[] = {
67+
{P0_19, UART_0, 1},
68+
{P1_13, UART_0, 3},
69+
{P1_27, UART_0, 2},
70+
{ NC , NC , 0}
71+
};
72+
```
73+
74+
Targets which don't make use of a pinmap, such as ones with peripherals that can be connected to any pin, must still define a pinmap as this is needed for testing. For these devices the pinmap does not need to be comprehensive. Instead it should list a representative sample of pins and peripherals so they can be tested appropriately.
5975

6076
### Testing
6177

0 commit comments

Comments
 (0)