ARMmbed / ARMmbed/mbed-os-example-blinky

Blinky program doesn't blink on some target boards

Open
#271 2 comments 0 reactions 0 assignees View on GitHub
IOTOSM-4310 Jira status: OPEN mirrored type: bug
Dominant language
CMake
Stars
42
Forks
154
PR merge metrics
No merged PRs in 30d

Description

### Description of defect

LED is not blinking on some target boards.
Recently, following code has been added in this example code.

```
// Initialise the digital pin LED1 as an output
#ifdef LED1
DigitalOut led(LED1);
#else
bool led;
#endif
```

The `#ifdef` detective doesn't recognize typedefed LED1 symbol, so LED doesn't blink for some target boards such as NXP LPC1768, Renesas, Nordic, Maxim and other target board which declare LED symbol as typedef.

Typical decleration for typedef is as below.

```
typedef enum {
// snip
LED1 = PF4,
LED2 = PF5,
LED3 = PF6,
LED4 = PF7,
// snip
} PinName;
```

AFAIK, C/C++ preprocessor can only handle macros and arithmetic constant expressions.

#### Target(s) affected by this defect ?

NXP LPC1768, Renesas, Nordic, Maxim, Toshiba target and others

#### Toolchain(s) (name and version) displaying this defect ?

```
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

#### What version of Mbed-os are you using (tag or sha) ?

```
mbed-os-example-blinky (#8164c4764939, tag: mbed-os-6.14.0)
`- mbed-os (#3377f083b3a6, tags: mbed-os-6.14.0, mbed-os-6.14.0-rc1)
```

#### What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

```
$ mbed --version
1.10.5
$ mbed-tools --version
7.35.0
```

#### How is this defect reproduced ?

Import the example, compile and run.

```
$ mbed-tools import https://github.com/ARMmbed/mbed-os-example-blinky
$ cd mbed-os-example-blinky
$ mbed compile -m rz_a1h -t gcc_arm
```

Contributor guide

Open the contributing guide

Research direction

Start with the blinky example code shown in the issue, especially the LED1 preprocessor check, and reproduce the report with mbed-tools using the rz_a1h target and gcc_arm toolchain. Done means the example blinks on the listed target boards whose LED symbols are typedefs, without regressing other targets.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.