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

Support ITM tracing for Ambiq Apollo3 targets #15280

Merged
merged 3 commits into from
May 9, 2022
Merged

Support ITM tracing for Ambiq Apollo3 targets #15280

merged 3 commits into from
May 9, 2022

Conversation

16L-YT
Copy link
Contributor

@16L-YT 16L-YT commented May 5, 2022

Summary of changes

Add the ITM tracing capability for Ambiq Apollo3 targets.

Impact of changes

Migration actions required

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label May 5, 2022
@ciarmcom ciarmcom requested a review from a team May 5, 2022 13:00
@ciarmcom
Copy link
Member

ciarmcom commented May 5, 2022

@16L-YT, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

0xc0170
0xc0170 previously approved these changes May 5, 2022
@0xc0170
Copy link
Contributor

0xc0170 commented May 5, 2022

CI started

@mbed-ci
Copy link

mbed-ci commented May 5, 2022

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM
jenkins-ci/mbed-os-ci_build-example-GCC_ARM
jenkins-ci/mbed-os-ci_build-example-ARM

@16L-YT
Copy link
Contributor Author

16L-YT commented May 5, 2022

@0xc0170

the failure is because:

[Error] itm_api.c@34,30: too few arguments to function call, expected 2, have 0
[ERROR] ./targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/itm_api.c:34:30: error: too few arguments to function call, expected 2, have 0
    am_bsp_itm_printf_enable();
    ~~~~~~~~~~~~~~~~~~~~~~~~ ^
./targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TARGET_SFE_ARTEMIS_MODULE/bsp/am_bsp.h:162:13: note: 'am_bsp_itm_printf_enable' declared here
extern void am_bsp_itm_printf_enable(uint32_t ui32Pin, am_hal_gpio_pincfg_t sPincfg);
            ^
1 error generated.

As am_bsp_itm_printf_enable can take 2 options

#ifdef AM_BSP_GPIO_ITM_SWO
extern void am_bsp_itm_printf_enable(void);
#else
extern void am_bsp_itm_printf_enable(uint32_t ui32Pin, am_hal_gpio_pincfg_t sPincfg);
#endif

in the same time itm_init take no arguments.

How I should keep things compatible without changing the BSP for each Apollo-based target? It seems only TARGET_SFE_ARTEMIS_MODULE target is missing the AM_BSP_GPIO_ITM_SWO definition.

In my custom target I replaced the AM_BSP_GPIO_ITM_SWO to DEBUG_SWO and define that macro in mbed_app.json .

Like this:

#ifdef DEBUG_SWO
void
am_bsp_itm_printf_enable(void)
{
    am_hal_tpiu_config_t TPIUcfg;

    //
    // Set the global print interface.
    //
    g_ui32PrintInterface = AM_BSP_PRINT_INFC_SWO;

    //
    // Enable the ITM interface and the SWO pin.
    //
    am_hal_itm_enable();
//  am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);

    //
    // Enable the ITM and TPIU
    // Set the BAUD clock for 1M
    //
    TPIUcfg.ui32SetItmBaud = AM_HAL_TPIU_BAUD_1M;
    am_hal_tpiu_enable(&TPIUcfg);
    am_hal_gpio_pinconfig(AM_BSP_GPIO_ITM_SWO, g_AM_BSP_GPIO_ITM_SWO);

    //
    // Attach the ITM to the STDIO driver.
    //
    am_util_stdio_printf_init(am_hal_itm_print);
} // am_bsp_itm_printf_enable()
#else
void
am_bsp_itm_printf_enable(void);
#endif

@mergify mergify bot dismissed 0xc0170’s stale review May 6, 2022 14:25

Pull request has been modified.

@0xc0170
Copy link
Contributor

0xc0170 commented May 6, 2022

CI started

@mbed-ci
Copy link

mbed-ci commented May 6, 2022

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

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

Successfully merging this pull request may close these issues.

None yet

5 participants