Skip to content

CM3DS Maintenance Pull Request #6119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@
/* size is 1522 bytes to accommodate the four-byte VLAN tag. */
#define ETH_MAX_FLEN 1522u /* recommended size for a VLAN frame */

/* Maximum Transfer Unit
* The IEEE 802.3 specification limits the data portion of the 802.3 frame
* to a minimum of 46 and a maximum of 1500 bytes, this is on L3 level.
*/
/*
* Maximum Transfer Unit
* The IEEE 802.3 specification limits the data portion of the 802.3 frame
* to a minimum of 46 and a maximum of 1522 bytes, this is on L2 level.
*/
#define ETH_L2_HEADER_LEN 22u

#define ETH_MAX_PAYLOAD_LEN (ETH_MAX_FLEN - ETH_L2_HEADER_LEN)

/*
* Set this value to 2 to ensure that payload address of packet buffers is
* aligned on a 32 bits boundary.
* The padding is removed before passing the packet to the ethernet driver,
* hence defining this value to 2 will not prevent alignment issues inside the
* ethernet driver.
*/
#define ETH_PAD_SIZE 0

#endif /* LWIPOPTS_CONF_H */
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,16 @@ err_t eth_arch_enetif_init(struct netif *netif)
err_t error = ERR_OK;
struct ethernetif *ethernetif;

ethernetif->is_enabled = 0;

LWIP_ASSERT("netif != NULL", (netif != NULL));

ethernetif = mem_malloc(sizeof(struct ethernetif));

if (ethernetif == NULL) {
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
return ERR_MEM;
}

ethernetif->is_enabled = 0;

#if LWIP_NETIF_HOSTNAME
/* Initialize interface hostname */
netif->hostname = HOSTNAME_STRING;
Expand Down
48 changes: 12 additions & 36 deletions targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/PeripheralNames.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
* Copyright (c) 2006-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,11 +23,11 @@ extern "C" {
#endif

typedef enum {
UART_0 = (int)CMSDK_UART0_BASE, /* MCC UART */
UART_1 = (int)CMSDK_UART1_BASE, /* MPS2+ UART */
UART_2 = (int)CMSDK_UART2_BASE, /* Shield 0 UART */
UART_3 = (int)CMSDK_UART3_BASE, /* Shield 1 UART */
UART_4 = (int)CMSDK_UART4_BASE /* Shield BT UART */
UART_0 = 0, /* MCC UART */
UART_1, /* MPS2+ UART */
UART_2, /* Shield 0 UART */
UART_3, /* Shield 1 UART */
UART_4 /* Shield BT UART */
} UARTName;

typedef enum {
Expand All @@ -53,38 +53,14 @@ typedef enum {
} ADCName;

typedef enum {
SPI_0 = (int)MPS2_SSP0_BASE,
SPI_1 = (int)MPS2_SSP1_BASE,
SPI_2 = (int)MPS2_SSP2_BASE,
SPI_3 = (int)MPS2_SSP3_BASE,
SPI_4 = (int)MPS2_SSP4_BASE
SPI_0 = 0,
SPI_1,
SPI_2,
SPI_3,
SPI_4,
SPI_NC = (SPI_4 + 1)
} SPIName;

typedef enum {
PWM_1 = 0,
PWM_2,
PWM_3,
PWM_4,
PWM_5,
PWM_6,
PWM_7,
PWM_8,
PWM_9,
PWM_10,
PWM_11
} PWMName;

#define STDIO_UART_TX USBTX
#define STDIO_UART_RX USBRX
#define STDIO_UART UART_1

#define MBED_UART0 MCC_TX, MCC_RX
#define MBED_UART1 USBTX, USBRX
#define MBED_UART2 XB_TX, XB_RX
#define MBED_UART3 SH0_TX, SH0_RX
#define MBED_UART4 SH1_TX, SH1_RX
#define MBED_UARTUSB USBTX, USBRX

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 5 additions & 3 deletions targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/PinNames.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
* Copyright (c) 2006-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,10 @@

#include "cmsis.h"

/* Pins used by mbed OS to identify STDIO UART pins */
#define STDIO_UART_TX USBTX
#define STDIO_UART_RX USBRX

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -27,8 +31,6 @@ typedef enum {
PIN_OUTPUT
} PinDirection;

#define PORT_SHIFT 5

typedef enum {
/* MPS2 EXP Pin Names */
EXP0 = 0,
Expand Down
72 changes: 72 additions & 0 deletions targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Cortex-M3 Design Start Eval package example on MPS2+ board

This folder includes the port of mbed OS on the example system of the Cortex-M3
Design Start Eval package. This example is implemented in FPGA on the MPS2+
board. Please check the [mbed page](https://os.mbed.com/platforms/ARM-CM3DS/) of
this target for more information.
For convenience, this target is called **CM3DS**.

## Compiling :construction_worker:

The target name is `ARM_CM3DS_MPS2`, you should be able to compile mbed OS
projects for CM3DS with:

```bash
mbed compile -t COMPILER -m ARM_CM3DS_MPS2
```

The following compilers are supported (replace `COMPILER` with):

* `ARM` for Arm Compiler version 5
* `GCC_ARM` for GNU Compiler for Arm
* `IAR` for IAR compiler

## Running :running:

Because of the new memory configuration introduced in commit `CM3DS: switch to
larger memories for code and data` it
has become more easy (and portable amoung all compilers) to use `.elf` files
instead of `.bin`.
For `.elf` files to work, you will need **at least version 2.2.5** of the MPS2+
firmware. You can find firmware version 2.2.6 and instructions on how to put it
in the MPS2+ board [here](https://community.arm.com/processors/designstart/f/discussions/9727/mps2-firmware-for-mbed).

## Testing :zap:

If you want to execute the mbed OS greentea tests on CM3DS, you will need
**at least firmware version 2.2.6**.

* `mbedls` does not automatically recognize which serial port is linked to the
board. Check it manually and create a file named `mbedls.json` containing
(at the same level than where you execute all commands):
```bash
{
"50040200074D652F3828F333": {
"serial_port": "/dev/ttyUSB0"
}
}
```
Replace `/dev/ttyUSB0` with your correct serial port
(something like `COM6` on Windows).

* `mbedls` does not link CM3DS target ID with its name so execute the command:
```bash
mbedls --mock 5004:ARM_CM3DS_MPS2
```

* Because greentea works with `.bin` files, you will have to first compile the
tests:
```bash
mbed test --compile -m ARM_CM3DS_MPS2 -t COMPILER
```

* Then use the script to change from `.bin` files to `.elf` in the test
specification file:
```bash
./targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/scripts/bin_to_elf.py BUILD/tests/ARM_CM3DS_MPS2/COMPILER/test_spec.json
```

* You can now run the tests :+1: :
```bash
mbed test --run -m ARM_CM3DS_MPS2 -t COMPILER
```
90 changes: 0 additions & 90 deletions targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/SDK/fpga.c

This file was deleted.

34 changes: 0 additions & 34 deletions targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/SDK/fpga.h

This file was deleted.

Loading