Skip to content
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

CYESKIT_064B0S2_4343W compile error with Mbed 6 and Pelion Client #13027

Closed
maclobdell opened this issue May 28, 2020 · 5 comments
Closed

CYESKIT_064B0S2_4343W compile error with Mbed 6 and Pelion Client #13027

maclobdell opened this issue May 28, 2020 · 5 comments

Comments

@maclobdell
Copy link
Contributor

maclobdell commented May 28, 2020

Description of defect

Compile error when building the latest mbed-os-example-pelion with CYESKIT_064B0S2_4343W.

Conflict between pinname macro and function pointer typename - each resolving to "A1", etc.

./mbed-os/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYESKIT_064B0S2_4343W/cybsp_types.h:232:37: error: expected nested-name-specifier before '(' token
  232 | #define CYBSP_A1                    (P10_1)
      |                                     ^
./mbed-os/targets/TARGET_Cypress/TARGET_PSOC6/PinNames.h:145:12: note: in expansion of macro 'CYBSP_A1'
  145 | #define A1 CYBSP_A1
      |            ^~~~~~~~
./mbed-cloud-client/mbed-client/mbed-client/functionpointer.h:113:32: note: in expansion of macro 'A1'
  113 | template <typename R, typename A1>

This is resolved by removing parenthesis around pinname definitions in
\mbed-os\targets\TARGET_Cypress\TARGET_PSOC6\TARGET_CYESKIT_064B0S2_4343W\cybsp_types.h

It looks like the predecessor kit - CY8CKIT_064S2_4343W already has this fix in:
\mbed-os\targets\TARGET_Cypress\TARGET_PSOC6\TARGET_CY8CKIT_064S2_4343W\cybsp_types.h

/** Arduino A0 */
#define CYBSP_A0                    P10_0
/** Arduino A1 */
#define CYBSP_A1                    P10_1
/** Arduino A2 */
#define CYBSP_A2                    P10_2
/** Arduino A3 */
#define CYBSP_A3                    P10_3
/** Arduino A4 */
#define CYBSP_A4                    P10_4
/** Arduino A5 */
#define CYBSP_A5                    P10_5
/** Arduino D0 */
#define CYBSP_D0                    (P5_0)

But, is this a valid fix, considering that the name "A1" seems to be shared by the function pointer?

Target(s) affected by this defect ?

CYESKIT_064B0S2_4343W

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

Arm compiler 6

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

mbed-os-6.0.0-beta-1

mbed-cloud-client 4.4.0

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

mbed-cli 1.10.1

How is this defect reproduced ?

  • mbed import https://github.com/ARMmbed/mbed-os-example-pelion

  • copy over this configuration in mbed_app.json

        "CYESKIT_064B0S2_4343W": {
            "target.macros_add"                         : ["MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\"","ARM_UC_USE_PAL_BLOCKDEVICE=0"],
            "target.network-default-interface-type"     : "WIFI",
            "storage_tdb_internal.internal_base_address": "0x101B8000",
            "storage_tdb_internal.internal_size"        : "0x00018000",
            "storage.storage_type"                      : "TDB_INTERNAL",
            "update-client.storage-address"             : "0x100DC000",
            "update-client.storage-size"                : "0x000DC000",
            "update-client.storage-locations"           : 1,
            "mbed-cloud-client.update-storage"          : "ARM_UCP_FLASHIAP",
            "update-client.application-details"         : "0x10000000",
            "target.bootloader_supported"               : true,
            "target.mbed_rom_start"                     : "0x10000400",
            "target.mbed_rom_size"                      : "0x001B7C00",
            "target.sectors"                            : [[268435456, 512]]
        }
  • copy in new mbed_cloud_dev_credentials.c
  • mbed compile -t GCC_ARM -m CYESKIT_064B0S2_4343W --profile release
@ciarmcom
Copy link
Member

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

@kjbracey
Copy link
Contributor

kjbracey commented May 29, 2020

I recall hitting this previously - issue was resolved by removing the () from the target's pin macro definitions.

(Then the template still works - it gets preprocessed to template <typename R, typename P10_1> which is fine).

Yes, the templates could be _Uglified too, but as the target header defines are injected into any application code including "mbed.h", they're the worse polluter, and making sure that A1 is defined as a single identifier token makes that intrusion a bit less painful.

Also, technically speaking, as non-implementation code, we're NOT allowed to use _A1 to uglify things like Callback.h, in case the implementation is using it.

Also, that error is coming from non-Mbed OS application code - Mbed client. Looks like they've got a local version of the old Mbed OS FunctionPointer.h? Was initially assuming it was Callback.h

@kjbracey
Copy link
Contributor

Problem recently mentioned in a comment here: #12838 (comment)

@0xc0170
Copy link
Contributor

0xc0170 commented May 29, 2020

@ARMmbed/team-cypress could you fix the definitions by removing () ?

kyle-cypress pushed a commit to kyle-cypress/mbed-os that referenced this issue May 30, 2020
Avoid build failures when arduino pin names collide with C++ template
argument names.
Addresses mbed-os issue ARMmbed#13027
kyle-cypress pushed a commit to kyle-cypress/mbed-os that referenced this issue May 30, 2020
Avoid build failures when arduino pin names collide with C++ template
argument names.
Addresses issue ARMmbed#13027
@maclobdell
Copy link
Contributor Author

This is fixed by PR #13045. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants