diff options
author | Christian Mauderer <Christian.Mauderer@embedded-brains.de> | 2016-08-01 13:16:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-02 07:47:04 +0200 |
commit | 5fe6d07ad5690e3d9c6445ca3a465a700a5a5015 (patch) | |
tree | 61843d4323136d7edb385735d68bfaed863ab3c5 /testsuites/sptests/splinkersets01/init.c | |
parent | score: Fix for RTEMS_DEBUG (diff) | |
download | rtems-5fe6d07ad5690e3d9c6445ca3a465a700a5a5015.tar.bz2 |
linker set: Allow adding any variable into content
The newly created macro adds any kind of variable into a linker set. It
allows (for example) the saving an execution state of a function using
the following method:
- put a group of different variables into one linker set
- save the memory area containing the group of variables before the
execution of a function
- restore the memory area after the function has been executed
Diffstat (limited to 'testsuites/sptests/splinkersets01/init.c')
-rw-r--r-- | testsuites/sptests/splinkersets01/init.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuites/sptests/splinkersets01/init.c b/testsuites/sptests/splinkersets01/init.c index 3d35a4e614..28c6384377 100644 --- a/testsuites/sptests/splinkersets01/init.c +++ b/testsuites/sptests/splinkersets01/init.c @@ -130,11 +130,35 @@ static void test(void) rtems_test_assert(&s2 == sb[2]); } +static void test_content(void) +{ + void volatile *b_rw = RTEMS_LINKER_SET_BEGIN(test_content_rw); + void volatile *e_rw = RTEMS_LINKER_SET_END(test_content_rw); + + void volatile const *b_ro = RTEMS_LINKER_SET_BEGIN(test_content_ro); + void volatile const *e_ro = RTEMS_LINKER_SET_END(test_content_ro); + + rtems_test_assert(&content_rw_1 >= b_rw); + rtems_test_assert(&content_rw_2 >= b_rw); + rtems_test_assert(&content_rw_3 >= b_rw); + rtems_test_assert(&content_rw_1 <= e_rw); + rtems_test_assert(&content_rw_2 <= e_rw); + rtems_test_assert(&content_rw_3 <= e_rw); + + rtems_test_assert(&content_ro_1 >= b_ro); + rtems_test_assert(&content_ro_2 >= b_ro); + rtems_test_assert(&content_ro_3 >= b_ro); + rtems_test_assert(&content_ro_1 <= e_ro); + rtems_test_assert(&content_ro_2 <= e_ro); + rtems_test_assert(&content_ro_3 <= e_ro); +} + static void Init(rtems_task_argument arg) { TEST_BEGIN(); test(); + test_content(); TEST_END(); rtems_test_exit(0); |