[ABANDONED] WARNING: Mis-aligned memory read (J-Link V618a on re-flashed STM32F3Discovery)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] WARNING: Mis-aligned memory read (J-Link V618a on re-flashed STM32F3Discovery)

    Hi,

    I'm using a re-flashed STM32F3Discovery board to do my freertos debugging on a F205RCT target.
    My IDE is Eclipse Oxygen with GNU ARM Eclipse plugin.

    In about 90% of all cases when I set a breakpoint, J-Link GDB Server crashes with the following error output:

    Source Code

    1. Setting breakpoint @ address 0x0800941E, Size = 2, BPHandle = 0x0004
    2. Starting target CPU...
    3. ...Breakpoint reached @ address 0x0800941E
    4. WARNING: Mis-aligned memory read: Address: 0x0000000B, NumBytes: 4, Alignment: 4 (Word-aligned)
    5. WARNING: Failed to read memory @ address 0x00CC493C
    6. ERROR: Error reading thread name in FreeRTOS task control block.
    7. Reading all registers
    8. Read 4 bytes @ address 0x0800941E (Data = 0x68DB6823)
    9. Removing breakpoint @ address 0x0800941E, Size = 2
    10. Reading 64 bytes @ address 0x20005F40
    11. Read 4 bytes @ address 0x0800AEE2 (Data = 0x68DB6823)
    12. Reading all registers
    13. Read 4 bytes @ address 0x0800F562 (Data = 0xB313681B)
    14. Read 4 bytes @ address 0x0800941E (Data = 0x68DB6823)
    15. Read 4 bytes @ address 0x0800AEE2 (Data = 0x68DB6823)
    16. Reading all registers
    17. ERROR: Error reading stack frame from FreeRTOS task.
    Display All


    I am programming in C++, using FreeRTOS 9.0.0.

    The project has been created using CubeMX and then manually converted to a C++ project.
    This is the majority of my FreeRTOSConfig.h:

    Source Code

    1. /* Ensure stdint is only used by the compiler, and not the assembler. */
    2. #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
    3. #include <stdint.h>
    4. #include "main.h"
    5. extern uint32_t SystemCoreClock;
    6. /* USER CODE BEGIN 0 */
    7. extern void configureTimerForRunTimeStats(void);
    8. extern unsigned long getRunTimeCounterValue(void);
    9. /* USER CODE END 0 */
    10. #endif
    11. #define configUSE_PREEMPTION 1
    12. #define configSUPPORT_STATIC_ALLOCATION 0
    13. #define configSUPPORT_DYNAMIC_ALLOCATION 1
    14. #define configUSE_IDLE_HOOK 0
    15. #define configUSE_TICK_HOOK 0
    16. #define configCPU_CLOCK_HZ ( SystemCoreClock )
    17. #define configTICK_RATE_HZ ((TickType_t)1000)
    18. #define configMAX_PRIORITIES ( 10 )
    19. #define configMINIMAL_STACK_SIZE ((uint16_t)64)
    20. #define configTOTAL_HEAP_SIZE ((size_t)70*1024)
    21. #define configMAX_TASK_NAME_LEN ( 20 )
    22. #define configGENERATE_RUN_TIME_STATS 1
    23. #define configUSE_TRACE_FACILITY 1
    24. #define configUSE_16_BIT_TICKS 0
    25. #define configIDLE_SHOULD_YIELD 0
    26. #define configUSE_MUTEXES 1
    27. #define configQUEUE_REGISTRY_SIZE 10
    28. #define configCHECK_FOR_STACK_OVERFLOW 2
    29. #define configUSE_MALLOC_FAILED_HOOK 1
    30. #define configENABLE_BACKWARD_COMPATIBILITY 0
    31. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
    32. /* Co-routine definitions. */
    33. #define configUSE_CO_ROUTINES 0
    34. #define configMAX_CO_ROUTINE_PRIORITIES ( 0 )
    35. /* Set the following definitions to 1 to include the API function, or zero
    36. to exclude the API function. */
    37. #define INCLUDE_vTaskPrioritySet 1
    38. #define INCLUDE_uxTaskPriorityGet 1
    39. #define INCLUDE_vTaskDelete 1
    40. #define INCLUDE_vTaskCleanUpResources 0
    41. #define INCLUDE_vTaskSuspend 1
    42. #define INCLUDE_vTaskDelayUntil 1
    43. #define INCLUDE_vTaskDelay 1
    44. #define INCLUDE_xTaskGetSchedulerState 1
    45. #define INCLUDE_xSemaphoreGetMutexHolder 1
    46. #define INCLUDE_uxTaskGetStackHighWaterMark 1
    47. #define INCLUDE_eTaskGetState 1
    48. /* Cortex-M specific definitions. */
    49. #ifdef __NVIC_PRIO_BITS
    50. /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
    51. #define configPRIO_BITS __NVIC_PRIO_BITS
    52. #else
    53. #define configPRIO_BITS 4
    54. #endif
    55. /* The lowest interrupt priority that can be used in a call to a "set priority"
    56. function. */
    57. #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
    58. /* The highest interrupt priority that can be used by any interrupt service
    59. routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
    60. INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
    61. PRIORITY THAN THIS! (higher priorities are lower numeric values. */
    62. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
    Display All


    I'm running JLinkGDBServer.exe -rtos GDBServer\RTOSPlugin_FreeRTOS.

    It seems to be same issue as: [ABANDONED] "Mis-aligned memory read" error when running GDB server with Freertos enabled and using a JLink base debugger

    The post was edited 1 time, last by vfel ().

  • Hi,

    please try setting "configUSE_PORT_OPTIMISED_TASK_SELECTION" to 0.

    I still could not reproduce a GDB server crash in case of this error (Error reading stack frame from FreeRTOS task.)
    But this error will result in an incorrect packet sent to the GDB client, which should not be the case. This will be fixed
    in the next software release (6.18b).

    Regards
    Arne
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    we are using 6.20a and facing the same problem. "configUSE_PORT_OPTIMISED_TASK_SELECTION" is set to 0. After the following error output debugging stucks completely:

    Source Code

    1. WARNING: Mis-aligned memory read: Address: 0x0000000B, NumBytes: 4, Alignment: 4 (Word-aligned)
    2. WARNING: Failed to read memory @ address 0x00278F3C
    3. ERROR: Error reading thread name in FreeRTOS task control block.
    4. Reading all registers


    This error is always thrown at this line at FreeRTOS tasks.c:

    Source Code

    1. /* There are no other tasks, or all the other tasks are inthe suspended state - make this the current task. */
    2. pxCurrentTCB = pxNewTCB;


    Our GDB Server ist started with following command line:

    Source Code

    1. C:\>"C:\Program Files (x86)\SEGGER\JLink_V620a\JLinkGDBServer.exe" -select USB -device STM32F437ZI -if SWD -speed 4000 -noir -rtos GDBServer/RTOSPlugin_FreeRTOS -excdbg


    Regards,
    Karlheinz

    PS: The GDB error is thrown independently from brakepoints. There is no brakepoint at "pxCurrentTCB = pxNewTCB;".

    The post was edited 2 times, last by kawosch ().

  • Hello Karlheinz,

    the RTOS plugin only gets active, if the CPU stops. There is no kind of "background monitoring" while the CPU is running.

    So, if there is no breakpoint at "pxCurrentTCB = pxNewTCB;", why does the CPU halt? Are you single stepping in this function?

    Does it also stop on this line, if the RTOS plugin is not loaded?

    Regards
    Arne
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello Arne,

    thanks for your fast reply.
    Sorry, I didn't explained the behaviour sufficiently.


    The error is thrown while the debugger runs. The CPU is not stopping in this case, it seems the program continues normally (LEDs blinking). Only debugging is terminated (or stucks) after this event. Then we have to restart the complete debugging in Eclipse, the GDB-Server has not to be restarted.

    The problem doesn't occur if we dont't start the GDB-Server with "GDBServer/RTOSPlugin_FreeRTOS".

    Regards,
    Karlheinz
  • Hello Karlheinz,

    could you please create a J-Link and a GDB server logfile?

    wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File

    The CPU must have been stopped, otherwise the plugin will never try to read memory. Maybe the CPU was immediately restarted.

    Regards
    Arne
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.