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

LPC1114: baremetal profile support #12623

Merged
merged 6 commits into from May 15, 2020
Merged

Conversation

toyowata
Copy link
Contributor

@toyowata toyowata commented Mar 13, 2020

Summary of changes

LPC1114FN28: Flash 32kB, RAM 4kB

This PR add baremetal profile support for LPC1114.

  • Add supprorted_c_libs with small lib in targets.json
  • Remove the target from some storage tests which require RAM more than this device
  • Fix comment typo ARM linker script
  • Polish GCC_ARM linker script
  • Remove unused section in the startup code for GCC_ARM
  • Disable interrupt in us_ticker_init (detected by tests-mbed_hal-common_tickers test case)

Note that IAR toolchain is not tested, because it does not support small library.

Impact of changes

Migration actions required

Documentation


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

@0xc0170 @MarceloSalazar


@toyowata toyowata requested a review from 0xc0170 March 13, 2020 05:55
@ciarmcom ciarmcom requested review from maclobdell, MarceloSalazar and a team March 13, 2020 06:00
@ciarmcom
Copy link
Member

@toyowata, thank you for your changes.
@maclobdell @MarceloSalazar @ARMmbed/mbed-os-storage @ARMmbed/mbed-os-maintainers please review.

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evedon please review
@jamesbeyond can we do something smart about these test cases? I don't want to accumulate list of exceptions like that

TESTS/configs/baremetal.json Outdated Show resolved Hide resolved
targets/targets.json Show resolved Hide resolved
targets/targets.json Outdated Show resolved Hide resolved
@evedon
Copy link
Contributor

evedon commented Mar 13, 2020

@evedon please review
@jamesbeyond can we do something smart about these test cases? I don't want to accumulate list of exceptions like that

All Mbed 2 board should set "target.c_lib": "small" in targets.json instead of TESTS/configs/baremetal.json.

And we need to do something about IAR not supporting small library. The new tools will revert to standard library. The issue is what to do with Mbed OS 5 tools.

@JojoS62
Copy link
Contributor

JojoS62 commented Mar 14, 2020

I have had tested also a LPC824 with mbed5 bare-metal. This works well, and had also raised an issue about the default_lib, which is actually an indicator that this target needs to be tested with mbed5. But therefore targets.json has to be changed.
How about a more generic keyword in the targets description? Like an Info/Warning/Error message that could be displayed in the build process. For the mbed2 targets f.e., a 'warning: this target has not been tested with mbed-os 5' ?
Another issue I found during testing: the settings for STDIO_UART_RX/TX settings do not apply to LPC targets. Instead of changing this for each target individually, I suggest to change it in "LPCTarget" or even "Target" as the base class for all targets. To make this fully working, the Pinnames.h has to use the STDIO_UART pinnames.
For targets with only 4 k RAM, the default stack size has to be decreased.
Any comments? I don't now the roadmap, but the integration of mbed2 looks great. Maybe the next mbed should not be v6, but mbed-os 7. Because its now really 5+2 :)

@toyowata
Copy link
Contributor Author

Applied review feedback from @evedon and rebased.

Copy link

@MarceloSalazar MarceloSalazar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment - looks good - thanks!

@evedon
Copy link
Contributor

evedon commented Mar 17, 2020

Applied review feedback from @evedon and rebased.

You need to add ["5"] to "release_versions" in targets.json.
Otherwise changes look good.

@evedon
Copy link
Contributor

evedon commented Mar 17, 2020

How about a more generic keyword in the targets description? Like an Info/Warning/Error message that could be displayed in the build process. For the mbed2 targets f.e., a 'warning: this target has not been tested with mbed-os 5' ?

We will look into addressing this request in the migration guide for Mbed 2 targets. If a target "release_versions" only lists ["2"] then it is an indication that it was not tested with Mbed OS 5.

Another issue I found during testing: the settings for STDIO_UART_RX/TX settings do not apply to LPC targets. Instead of changing this for each target individually, I suggest to change it in "LPCTarget" or even "Target" as the base class for all targets. To make this fully working, the Pinnames.h has to use the STDIO_UART pinnames.

What change are you proposing for "LPCTarget"?

@JojoS62
Copy link
Contributor

JojoS62 commented Mar 17, 2020

What change are you proposing for "LPCTarget"?

I can create a PR, I have added this config section to the LPCTarget, but I think this config should be in "Target", there is already the setting for "console-uart".

    "LPCTarget": {
        "inherits": [
            "Target"
        ],
        "post_binary_hook": {
            "function": "LPCTargetCode.lpc_patch"
        },
        "config": {
                "stdio_uart_tx": {
                "help": "default TX STDIO pins is defined in PinNames.h file, but it can be overridden"
            },
            "stdio_uart_rx": {
                "help": "default RX STDIO pins is defined in PinNames.h file, but it can be overridden"
            }
        },
        "public": false

Actually, the LPC targets do not know about stdio_uart_tx/rx settings. When it is not used in PinNames.h, it does not break compatibility.

@toyowata
Copy link
Contributor Author

@evedon

You need to add ["5"] to "release_versions" in targets.json.

Done. Pushed commit and rebased to master.

@evedon
Copy link
Contributor

evedon commented Mar 18, 2020

Which command did you use to run the greentea tests? I was expecting to see some tests skipped (those which are skipped in bare metal mode).

@toyowata
Copy link
Contributor Author

@evedon

Which command did you use to run the greentea tests?

The command is:

mbed test -m lpc1114 -t arm --app-config TESTS/configs/baremetal.json   

evedon
evedon previously approved these changes Mar 18, 2020
@mergify mergify bot added needs: CI and removed needs: review labels Mar 18, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 18, 2020

CI started

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 19, 2020

@toyowata There's an error in the logs: [2020-03-18T15:03:43.493Z] tools.utils.InvalidReleaseTargetException: Target 'LPC1114' must set the 'c_lib' to 'std' to be included in the mbed OS 5.0 official release.

@@ -23,6 +23,11 @@

using namespace utest::v1;

// TODO HACK, replace with available ram/heap property
#if defined(TARGET_LPC1114)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem right. Replace TARGET_LPC1114 by what is preventing the target from running the test.
Do the same everywhere you have prevented a test from running.

Copy link
Contributor Author

@toyowata toyowata Apr 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugueskamba Thanks for your comment. How do you think about this?

#define TEST_BLOCK_SIZE 128
#define TEST_BLOCK_DEVICE_SIZE 32*TEST_BLOCK_SIZE
#define TEST_BLOCK_COUNT 10
#define TEST_ERROR_MASK 16

#if (MBED_RAM_SIZE <= TEST_BLOCK_DEVICE_SIZE)
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why this test needs to be excluded for that board.
Here is a question, why do you need to exclude this test for that board?
If the reason is that the size of the block device is greater than the available RAM then it is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the LPC1114 RAM size is 4kB which is not suitable to run this test case.

#define TEST_BLOCK_SIZE 128
#define TEST_BLOCK_DEVICE_SIZE 32*TEST_BLOCK_SIZE

(snip)

void test_read_write()
{
    uint8_t *dummy = new (std::nothrow) uint8_t[TEST_BLOCK_DEVICE_SIZE];

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the LPC1114 RAM size is 4kB which is not suitable to run this test case.

Then have that in your pre-processor macro.

@toyowata
Copy link
Contributor Author

@hugueskamba I added a commit for some test cases to add memory check for RAM constraint device here, please can you review.

@toyowata
Copy link
Contributor Author

toyowata commented May 8, 2020

rebased.

@0xc0170 @hugueskamba Any more work to do for this PR?

@0xc0170
Copy link
Contributor

0xc0170 commented May 8, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented May 8, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 6
Build artifacts

@@ -28,6 +28,10 @@ using namespace utest::v1;
#define TEST_BLOCK_COUNT 10
#define TEST_ERROR_MASK 16

#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= TEST_BLOCK_DEVICE_SIZE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this condition different than the other two files but the comment the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the heap_block_device test case allocates memory using TEST_BLOCK_DEVICE_SIZE.

uint8_t *dummy = new (std::nothrow) uint8_t[TEST_BLOCK_DEVICE_SIZE];

And other test cases use different symbols.

uint8_t *dummy = new (std::nothrow) uint8_t[BLOCK_COUNT * BLOCK_SIZE];

]
},
"c_lib": "small",
"supported_application_modes": ["bare-metal"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still haven’t modified this.

@toyowata
Copy link
Contributor Author

@hugueskamba @0xc0170
I fixed to use supported_application_profiles in the targets.json and rebased.

Copy link
Collaborator

@hugueskamba hugueskamba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved assuming you successfully ran mbed-os-example-blinky-baremetal on this target after the latest changes.

@toyowata
Copy link
Contributor Author

@hugueskamba Yes, the mbed-os-example-blinky-baremetal works fine on this target.

@0xc0170
Copy link
Contributor

0xc0170 commented May 13, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented May 13, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 8
Build artifacts

@0xc0170 0xc0170 merged commit 6cbe22d into ARMmbed:master May 15, 2020
@mergify mergify bot removed the ready for merge label May 15, 2020
@toyowata toyowata deleted the baremetal_lpc1114 branch June 6, 2020 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Pull request triage
  
needs: work
Development

Successfully merging this pull request may close these issues.

None yet