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

STM32 target inherit: US_TICKER_MASK not defined #12990

Closed
pilotak opened this issue May 18, 2020 · 9 comments · Fixed by #13090
Closed

STM32 target inherit: US_TICKER_MASK not defined #12990

pilotak opened this issue May 18, 2020 · 9 comments · Fixed by #13090

Comments

@pilotak
Copy link
Contributor

pilotak commented May 18, 2020

Description of defect

When compiling a file below with target -m NUCLEO_F412ZG it compiles fine, but if I compile with -m test (custom target) the error below comes up.

Compile [ 99.0%]: hal_tick_overrides.c
[Error] hal_tick_overrides.c@53,56: 'US_TICKER_MASK' undeclared (first use in this function)
[ERROR] .\mbed-os\targets\TARGET_STM\hal_tick_overrides.c: In function 'HAL_GetTick':
.\mbed-os\targets\TARGET_STM\hal_tick_overrides.c:53:56: error: 'US_TICKER_MASK' undeclared (first use in this function)
   53 |     uint32_t elapsed_time = (((new_time - prev_time) & US_TICKER_MASK) + prev_tick_remainder);
      |                                                        ^~~~~~~~~~~~~~
.\mbed-os\targets\TARGET_STM\hal_tick_overrides.c:53:56: note: each undeclared identifier is reported only once for each function it appears in

Target(s) affected by this defect ?

Possibly all STM targets

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

GCC-ARM: 9.2.1 20191025

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

e345542

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 ?

main.cpp

#include "mbed.h"

int main() {
    printf("test\n");
    return 0;
}

custom_targets.json

{
    "test": {
        "inherits": ["NUCLEO_F412ZG"],
        "supported_form_factors": [],
        "overrides": {
            "clock_source": "USE_PLL_HSE_XTAL"
        }
    }
}
@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-2674

@pilotak
Copy link
Contributor Author

pilotak commented May 18, 2020

It's only ok up to no later than d058586

@pilotak
Copy link
Contributor Author

pilotak commented May 28, 2020

ping @jeromecoutant

@jeromecoutant
Copy link
Collaborator

It's working on my side...

@jeromecoutant
Copy link
Collaborator

@pilotak Do you find the issue on your side ?

@pilotak
Copy link
Contributor Author

pilotak commented Jun 9, 2020

Sorry for delay. I did an investigation and it only works if there in no device.h in TARGET_TEST folder.

device.h

#ifndef MBED_DEVICE_H
    #define MBED_DEVICE_H
    #include "objects.h"

    #define CONF_BOARD_TYPE     1
    #define CONF_BOARD_REV      3
    #define VOLTAGE_REFERENCE   12100000UL
    #define PROCESSOR_TYPE      1
#endif

@jeromecoutant
Copy link
Collaborator

Good catch

Could you check jeromecoutant@4740775

Thx

@pilotak
Copy link
Contributor Author

pilotak commented Jun 9, 2020

yep, that fixed it

@kjbracey
Copy link
Contributor

Fix in #13090 is invalid, and I'm requesting it be reverted.

The correct fix here would have been to ensure that you have the necessary include of us_ticker_defines.h in your replacement device.h, as the original device.h did.

Or make your device.h include the original device.h, rather than objects.h, then add your defines.

(I'm not actually clear on include path set-up here - if you have your own device.h, is it deterministic whether TARGET_TEST/device.h or TARGET_STM/device.h gets read?)

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

Successfully merging a pull request may close this issue.

4 participants