FreeRTOS stucks at prvPortStartFirstTask in s32k3xx

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS stucks at prvPortStartFirstTask in s32k3xx

215 Views
AntoZ
Contributor II

Hi Everyone , 

i am trying to run FreeRTOS run in S32k328, i created a single task and try to run it , at first time runs properly , but after that  code stuck at one

Hi Everyone , 

i am trying to run FreeRTOS run in S32k328, i created a single task and try to run it , at first time runs properly , but after that  code stuck at one prvPortStartFirstTask(), 

AntoZ_0-1759158821831.png

AntoZ_3-1759158949207.png

 

i changed the svc handler name in vector table , we got this error, posted the images for your reference, 

Screenshot 2025-09-29 203137.png

AntoZ_1-1759158884509.png

 

AntoZ_2-1759158900388.png

do anything needs to change?

(), 

AntoZ_0-1759158821831.png

AntoZ_3-1759158949207.png

 

i changed the svc handler name in vector table , we got this error, posted the images for your reference, 

Screenshot 2025-09-29 203137.png

AntoZ_1-1759158884509.png

 

AntoZ_2-1759158900388.png

do anything needs to change?

S32K3 

 

0 Kudos
Reply
1 Reply

165 Views
PavelL
NXP Employee
NXP Employee

Hello @AntoZ ,

Thank you for the additional information and screenshots.

From the register view, I can see that the VTOR (Vector Table Offset Register) is set to 0x20000000, which means the vector table is relocated to RAM. This is a valid configuration, but it requires that the vector table in RAM is correctly initialized, including the entry for the SVC_Handler.

Since you mentioned that you renamed the SVC_Handler, please ensure the following:

  1. The vector table in RAM at 0x20000000 must contain the correct address of your renamed SVC_Handler.
    If the table was copied from flash, make sure it reflects the updated symbol name.

  2. If you are using C++, ensure the handler is declared with extern "C" to avoid name mangling:

     
    extern "C" void My_SVC_Handler(void)
     
  3. Verify that the vector table is correctly copied to RAM before setting VTOR.
    This is typically done early in SystemInit() or main().

  4. Double-check that the renamed handler is correctly linked and not discarded by the linker.

If the issue persists, could you please share a minimal version of your project that reproduces the problem? This would help us analyze the vector table setup and handler linkage in more detail.

Best regards,

Pavel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2177560%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFreeRTOS%20stucks%20at%20prvPortStartFirstTask%20in%20s32k3xx%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2177560%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Everyone%20%2C%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20am%20trying%20to%20run%20FreeRTOS%20run%20in%20S32k328%2C%20i%20created%20a%20single%20task%20and%20try%20to%20run%20it%20%2C%20at%20first%20time%20runs%20properly%20%2C%20but%20after%20that%26nbsp%3B%20code%20stuck%20at%20one%3C%2FP%3E%3CP%3EHi%20Everyone%20%2C%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20am%20trying%20to%20run%20FreeRTOS%20run%20in%20S32k328%2C%20i%20created%20a%20single%20task%20and%20try%20to%20run%20it%20%2C%20at%20first%20time%20runs%20properly%20%2C%20but%20after%20that%26nbsp%3B%20code%20stuck%20at%20one%26nbsp%3B%3CSPAN%3EprvPortStartFirstTask()%2C%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_0-1759158821831.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_0-1759158821831.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358923iF120B1470D6FCD3B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_0-1759158821831.png%22%20alt%3D%22AntoZ_0-1759158821831.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_3-1759158949207.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_3-1759158949207.png%22%20style%3D%22width%3A%20342px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358927i2ABFF69A6F65056D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_3-1759158949207.png%22%20alt%3D%22AntoZ_3-1759158949207.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3Ei%20changed%20the%20svc%20handler%20name%20in%20vector%20table%20%2C%20we%20got%20this%20error%2C%20posted%20the%20images%20for%20your%20reference%2C%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202025-09-29%20203137.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%202025-09-29%20203137.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358924i65A3187E47109B86%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202025-09-29%20203137.png%22%20alt%3D%22Screenshot%202025-09-29%20203137.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_1-1759158884509.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_1-1759158884509.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358925i35AB7C8EF3567939%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_1-1759158884509.png%22%20alt%3D%22AntoZ_1-1759158884509.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_2-1759158900388.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_2-1759158900388.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358926iA8BCBF647080FC5D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_2-1759158900388.png%22%20alt%3D%22AntoZ_2-1759158900388.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Edo%20anything%20needs%20to%20change%3F%3C%2FP%3E%3CP%3E%3CSPAN%3E()%2C%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_0-1759158821831.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_0-1759158821831.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358923iF120B1470D6FCD3B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_0-1759158821831.png%22%20alt%3D%22AntoZ_0-1759158821831.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_3-1759158949207.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_3-1759158949207.png%22%20style%3D%22width%3A%20342px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358927i2ABFF69A6F65056D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_3-1759158949207.png%22%20alt%3D%22AntoZ_3-1759158949207.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3Ei%20changed%20the%20svc%20handler%20name%20in%20vector%20table%20%2C%20we%20got%20this%20error%2C%20posted%20the%20images%20for%20your%20reference%2C%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202025-09-29%20203137.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%202025-09-29%20203137.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358924i65A3187E47109B86%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%202025-09-29%20203137.png%22%20alt%3D%22Screenshot%202025-09-29%20203137.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_1-1759158884509.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_1-1759158884509.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358925i35AB7C8EF3567939%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_1-1759158884509.png%22%20alt%3D%22AntoZ_1-1759158884509.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AntoZ_2-1759158900388.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22AntoZ_2-1759158900388.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358926iA8BCBF647080FC5D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AntoZ_2-1759158900388.png%22%20alt%3D%22AntoZ_2-1759158900388.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Edo%20anything%20needs%20to%20change%3F%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FS32K3%2Fpd-p%2FS32K3%22%20class%3D%22lia-product-mention%22%20data-product%3D%221688-1%22%20target%3D%22_blank%22%3ES32K3%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2178697%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FreeRTOS%20stucks%20at%20prvPortStartFirstTask%20in%20s32k3xx%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2178697%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252204%22%20target%3D%22_blank%22%3E%40AntoZ%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20the%20additional%20information%20and%20screenshots.%3C%2FP%3E%0A%3CP%3EFrom%20the%20register%20view%2C%20I%20can%20see%20that%20the%20VTOR%20(Vector%20Table%20Offset%20Register)%20is%20set%20to%200x20000000%2C%20which%20means%20the%20vector%20table%20is%20relocated%20to%20RAM.%20This%20is%20a%20valid%20configuration%2C%20but%20it%20requires%20that%20the%20vector%20table%20in%20RAM%20is%20correctly%20initialized%2C%20including%20the%20entry%20for%20the%20SVC_Handler.%3C%2FP%3E%0A%3CP%3ESince%20you%20mentioned%20that%20you%20renamed%20the%20SVC_Handler%2C%20please%20ensure%20the%20following%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EThe%20vector%20table%20in%20RAM%20at%200x20000000%20must%20contain%20the%20correct%20address%20of%20your%20renamed%20SVC_Handler.%3CBR%20%2F%3EIf%20the%20table%20was%20copied%20from%20flash%2C%20make%20sure%20it%20reflects%20the%20updated%20symbol%20name.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EIf%20you%20are%20using%20C%2B%2B%2C%20ensure%20the%20handler%20is%20declared%20with%20extern%20%22C%22%20to%20avoid%20name%20mangling%3A%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%20tabindex%3D%220%22%20role%3D%22group%22%20aria-label%3D%22Code%20Preview%22%3E%0A%3CDIV%20dir%3D%22ltr%22%20data-testid%3D%22ComponentFluentProviderId%22%3E%0A%3CDIV%20tabindex%3D%22-1%22%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3C!--ScriptorStartFragment--%3Eextern%20%22C%22%20void%20My_SVC_Handler(void)%3C!--ScriptorEndFragment--%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EVerify%20that%20the%20vector%20table%20is%20correctly%20copied%20to%20RAM%20before%20setting%20VTOR.%3CBR%20%2F%3EThis%20is%20typically%20done%20early%20in%20SystemInit()%20or%20main().%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EDouble-check%20that%20the%20renamed%20handler%20is%20correctly%20linked%20and%20not%20discarded%20by%20the%20linker.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EIf%20the%20issue%20persists%2C%20could%20you%20please%20share%20a%20minimal%20version%20of%20your%20project%20that%20reproduces%20the%20problem%3F%20This%20would%20help%20us%20analyze%20the%20vector%20table%20setup%20and%20handler%20linkage%20in%20more%20detail.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPavel%3C%2FP%3E%3C%2FLINGO-BODY%3E