AnsweredAssumed Answered

Is "DMEM_KERNEL_NUM" Missing When S32v234 DS2.0 Generates APU_XXX__MKDBStub?

Question asked by Brilly Wu on Jun 11, 2018

In the NXP\S32DS_Vision_v2.0\S32DS\s32v234_sdk\libs\apex\common\include\apu_microkernel.h file, two external variables are defined:

Extern volatile int32_t DMEM_KERNEL_NUM[] __attribute__ ((section (".DMEM_KERNEL_NUM")));
Extern volatile KERNEL_INFO DMEM_KERNEL_DB[] __attribute__ ((section (".DMEM_KERNEL_DB")));

 

In the DS2.0 compilation process, the generated file: 01workspace\DS_workspace\xxxAPU_gen\src\APU_xxx__MKDBstub.cpp, has only variables:

Volatile KERNEL_INFO DMEM_KERNEL_DB[2] =
{
{(int32_t)(&APU_XXX), "APU_XXX"},
{0xFFFFFFFF, ""}
};

DMEM_KERNEL_NUM is not defined.

Also, the Load.h file generated when DS2.0 compiles:

Const SEG_HOST_TYPE APU_WGH_LOAD_SEGMENTS[5][4] =
{
{0, (SEG_HOST_TYPE)(&APU_WGH_LOAD_PMEM[ 0]), 0x00000000, 16192 },
{ 1, (SEG_HOST_TYPE)(&APU_WGH_LOAD_DMEM[ 0]), 0x00000600, 8752 },
{ 1, (SEG_HOST_TYPE)(&APU_WGH_LOAD_DMEM[2188]), 0x00010800, 68 },
{ 2, 0, 0x00000100, 256 },
{ -1, 0, 0, 0 },
};

Display db section content length 68.

It is exactly the length of DMEM_KERNEL_DB[2]+4 kernel kernels

The resulting load.h,

Const SEG_MEM_TYPE APU_WGH_LOAD_DMEM[ 2208] =
{

......

0x00000007U, 0x0000000DU, 0x5F555041U, 0x00484757U, // (2188) 00010800
0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, // ( 2192) 00010810
0x00000000U, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, // (2196) 00010820
0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, // (2200) 00010830
0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, // (2204) 00010840

}

The first number is 7, which means there are 7 kernels. However, there are actually only two.

One address is at 0x0000000DU and one address is at 0xFFFFFFFFU.

In the file:

NXP\S32DS_Vision_v2.0\S32DS\s32v234_sdk\libs\apex\acf\src\kernel_manager_host.cpp,

This function will cause memory access to cross boundaries:

Int KernelManager::InitLoadKernelDB( int /*apuid*/, const LOAD_SEGMENT_t* seg_addr)

{

......

Memcpy(mkernel_list, (KERNEL_INFO*)(&(src_ptr[1])), sizeof(KERNEL_INFO)* kn);

}

Outcomes