This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSRM48HDK: ALU detection and MPU use

Part Number: TMDSRM48HDK
Other Parts Discussed in Thread: HALCOGEN

Dear team,


1. My customer needs to do ALU detection and response register flag detection, does RM48 have a corresponding method or mechanism?

2  Is it possible to implement stack overflow detection with MPU? If there is an access violation in the MPU, how will the chip respond, will the ESM module receive an exception or other processing methods?


He is using the RM48 HDK. I didn't find the description in the manual. I saw the description of the MPU in other chip manuals. Is the RM48 response the same as other chips?

BR,

SUSAN

  • Hi Susan,

    1. My customer needs to do ALU detection and response register flag detection, does RM48 have a corresponding method or mechanism?

    What do you mean by ALU detection or register flag detection? Are they looking for mechanisms to test just the ALU and whether the condition code flags are being set / reset correctly? Hercules MCUs do not have a separate built-in mechanism to test this functionality. The CPU self-test using the Self-Test Controller (STC) includes tests for the ALU operation as well.

    2. Is it possible to implement stack overflow detection with MPU? If there is an access violation in the MPU, how will the chip respond, will the ESM module receive an exception or other processing methods?

    Yes, this is a valid use case for the MPU to identify how much stack is required. A CPU access (stack write from a "PUSH" for example) to a region not permitted by the MPU will cause an abort response.  There is no ESM error in this case. The CPU's abort handler must read the data fault address and status registers to identify the cause of the abort and respond accordingly.

    Information about the MPU is included in the Cortex-R4F Technical Reference Manual from ARM: https://developer.arm.com/docs/ddi0363/g

    Regards, Sunil

  • Thanks for your support!

    1 What do you mean by ALU detection or register flag detection?


    For example, perform an addition, subtraction, or shift operation, and then check if the overflow flag or the carry flag in the flag bit register is correct.

    2 If I use the MPU mechanism to do stack overflow detection, I only need to set the top of the stack and the bottom of the stack to not allow the area, and then stop the processing and add the response. Does it work?  

  • Hi Susan,

    1 What do you mean by ALU detection or register flag detection?


    For example, perform an addition, subtraction, or shift operation, and then check if the overflow flag or the carry flag in the flag bit register is correct.

    >> As I mentioned, this functionality gets tested along with the other CPU logic when running the Logic Built-In-Self-test (LBIST) using the CPU's Self-Test Controller (STC). There is no other hardware mechanism to test this logic. The application can include a software test to verify this functionality if required.

    2 If I use the MPU mechanism to do stack overflow detection, I only need to set the top of the stack and the bottom of the stack to not allow the area, and then stop the processing and add the response. Does it work?  

    >> The initialization routine generated by HALCoGen allows you to setup the top of the stacks for all CPU modes. These stacks grow downwards. For example, the coreInitStackPointer() routine uses the following default values (from sys_core.asm):

    userSp .word 0x08000000+0x00001000
    svcSp .word 0x08000000+0x00001000+0x00000100
    fiqSp .word 0x08000000+0x00001000+0x00000100+0x00000100
    irqSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100
    abortSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100+0x00000100
    undefSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100+0x00000100+0x00000100

    The stack for user (and System) mode starts at 0x08001000 and decrements from there to 0x08000000. If the stack "grows" past this address (below 0x08000000) it will automatically generate an abort without any MPU configuration.

    For other modes, if the stack used is more than the size allocated above (256 bytes) it will overwrite stack contents of other modes, causing code execution problems. These issues can be identified using an MPU region to block CPU writes to RAM outside of the available stack. This method is only used to identify the maximum stack size required for each mode during development.