Hello MicroEJ team,
I worked on an implementation of LLKERNEL to load features in RAM.
The implementation resembles what is done on the STM32F7508 in the sense that some natives are stubbed :
I’ve integrated the sources to run the LLKERNEL C testsuite available here:
Instead of getting the expected result (see link above), I get the following result:
LLKERNEL resource allocate
LLKERNEL tests.T_LLKERNEL_resource_allocate (x\validation\tests\llkernel\c\src\t_llkernel.c 100) exp 1 was 0
LLKERNEL resource allocate and free
LLKERNEL tests.T_LLKERNEL_resource_allocate_and_free (x\validation\tests\llkernel\c\src\t_llkernel.c 161) exp 1 was 0
LLKERNEL resource allocate overflow
OK
LLKERNEL resource install overflow
OK
LLKERNEL resource install out of bounds
LLKERNEL tests.T_LLKERNEL_resource_install_out_of_bounds (x\validation\tests\llkernel\c\src\t_llkernel.c 266) exp 1 was 0
INFINITE_LOOP_ASSERT_FAILED
Every failed assertion in the above traces is due to the function LLKERNEL_IMPL_getAllocatedFeaturesCount
which is stubbed as follows:
int32_t LLKERNEL_IMPL_getAllocatedFeaturesCount(void) {
// No persistence support
return 0;
}
If I try to implement the function LLKERNEL_IMPL_getAllocatedFeaturesCount
with a global variable that increments on a successful call to LLKERNEL_IMPL_allocateFeature
and decrements on a successful call to LLKERNEL_IMPL_freeFeature
, the VM’s behavior changes and makes a call to the native LLKERNEL_IMPL_freeFeature
.
decrements on a successful call to LLKERNEL_IMPL_freeFeature
, the VM’s behavior changes and makes a call to the native LLKERNEL_IMPL_getFeatureHandle
stubbed as follows:
int32_t LLKERNEL_IMPL_getFeatureHandle(int32_t allocation_index) {
// No persistence support
MEJ_LOG_ERROR_KERNEL("%s : No persistence support, code stopped.",__func__);
KERNEL_ASSERT_FAIL();
}
If I implement LLKERNEL_IMPL_getFeatureHandle
so that it returns 0 all the time, I have an infinite loop of calls to the native LLKERNEL_IMPL_getFeatureHandle
.
If I implement LLKERNEL_IMPL_getFeatureHandle
so that it returns 1 all the time, in order to see if I’m out of the infinite loop, I get a hardfault.
So I have the following 2 questions:
- What LLKERNEL tests are supposed to pass with an implementation similar to STM32F7508?
- How should the implementation be modified to pass all the tests? For example, with
LLKERNEL_IMPL_getFeatureHandle
, does the VM expect an address to a pointer of typeinstalled_feature_t
?
Thanks in advance for your help,
S.