Skip to content

Fix for issue #8368 #8377

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

Merged
merged 2 commits into from
Oct 22, 2018
Merged

Fix for issue #8368 #8377

merged 2 commits into from
Oct 22, 2018

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Oct 11, 2018

Description

This is fix for issue #8368.

Test is causing some problems on REALTEK_RTL8195AM and ARM compiler. There is some kind of memory issue. Probably there is not enough memory space for global data provided by the test. Data definitions have been moved into test function body so, they will land on stack. With this fix the test works on REALTEK_RTL8195AM/ARM.

Additionally optimize the test by using templates instead of global variables.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

mprse added 2 commits October 11, 2018 11:58
This is fix for issue 8368.

Test is causing some problems on `REALTEK_RTL8195AM` and `ARM` compiler. There is some kind of memory issue. Probably there is not enough memory space for global data provided by the test. Data definitions have been moved into test function body so, they will land on stack. With this fix the test works on `REALTEK_RTL8195AM/ARM`.
@studavekar
Copy link
Contributor

@mprse thanks for the fix 👍

@mprse
Copy link
Contributor Author

mprse commented Oct 12, 2018

@M-ichae-l
I made some further tests and found that on REALTEK_RTL8195AM and AMR compiler I can declare in the test up to 90 bytes of initialised global data (located in .data section). For example on GCC_ARM I am able to allocate 10k (couldn't check on IAR). Could you check that, maybe there is some problem is scatter file?

Here is the test code:

#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"

#include "mbed.h"
#include "mbed_mktime.h"

char buffer[1024*10] = {0xff};

using namespace utest::v1;

void test()
{
    memset(&buffer,0, sizeof(buffer));
}

Case cases[] = {
    Case("test", test)
};

utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
    GREENTEA_SETUP(20, "default_auto");
    return greentea_test_setup_handler(number_of_cases);
}

Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);

int main()
{
    return Harness::run(specification);
}

@studavekar
Copy link
Contributor

@ARMmbed/mbed-os-maintainers can you review?

@@ -53,6 +51,7 @@ bool is_leap_year(int year)
* When _rtc_is_leap_year() function is called.
* Then _rtc_is_leap_year() returns true if given year is a leap year; false otherwise.
*/
template <rtc_leap_year_support_t rtc_leap_year_support>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this defined twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but what is defined twice?

Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 54 and 93

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 these are two different template functions. Is it possible to define one template for many functions? I have never seen such case.

Copy link
Contributor

Choose a reason for hiding this comment

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

It just seemed odd to me, but our local C++ expert (@geky) mentioend that it's par for the course. I'm use to seeing templates be used in classes, not functions.

Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

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

Iiinteresting. Have a question, but should be good.

@cmonr
Copy link
Contributor

cmonr commented Oct 21, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 21, 2018

Build : SUCCESS

Build number : 3414
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8377/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 21, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 21, 2018

@cmonr cmonr merged commit 1123c2b into ARMmbed:master Oct 22, 2018
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.

6 participants