ARMmbed / mbed-os-example-blinky

Blinky example for Mbed OS 6.0
Apache License 2.0
42 stars 157 forks source link

Blinky program doesn't blink on some target boards #271

Open toyowata opened 2 years ago

toyowata commented 2 years ago

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
ciarmcom commented 2 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-4310

plsecker commented 11 months ago

Seen here: https://forums.mbed.com/t/max32625-blinky-doesnt-work-out-of-the-box-baremetal-does/20693