This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

main_TcpNet throws PAbt

Hi,

My application is running from 0x20000 started by a 2nd stage bootloader located at 0x00000.

When my application is started by the bootloader, the function call main_TcpNet throws a PAbt exception after a while. Sometimes the exception occurs nearly immediately, sometimes the application runs for several minutes. I removed everything else from my application to track the cause of the PAbt. Now the init task only starts the TCP task and the tick-timer task before the init terminates. I don't have to establish a connection or do anything to cause the PAbt exception.

In the following cases the application runs without throwing an exception:

1) The application without the tcp-task calling main_TcpNet runs without any problems.

2) When no network cable is connected the application runs without any problems.

3) When I start the application directly without running through the bootloader everything works fine.

I also have reduced the bootloader to the one only command to call the application at 0x20000.

My reduced bootloader.c:


#define APPL_RUN_ADDR           0x00020000

typedef void (*FP)(void);

void run_appl()
{
    FP fp;

    VICIntEnClr = 0xFFFFFFFF; // Disable all interrupt
    fp = (FP)APPL_RUN_ADDR;
    (*fp)();
}

int main(void)
{
    run_appl();
}

This exception I can observe at my own Hardware as well as with the MBC2300 Evalboard.

I'm using the following environment:

IDE-Version:
µVision V4.71.2.0
Copyright (C) 2013 ARM Ltd and ARM Germany GmbH. All rights reserved.

Tool Version Numbers:
Toolchain:          MDK-ARM Professional   Version: 4.71.0.0
Toolchain Path:     C:\Keil\ARM\ARMCC\bin\ 
C Compiler:         Armcc.Exe              V5.03.0.69
Assembler:          Armasm.Exe             V5.03.0.69
Linker/Locator:     ArmLink.Exe            V5.03.0.69
Librarian:          ArmAr.Exe              V5.03.0.69
Hex Converter:      FromElf.Exe            V5.03.0.69
CPU DLL:            SARM.DLL               V4.71.0.0
Dialog DLL:         DARMP.DLL              V1.51
Target DLL:         ULP2ARM.DLL            V2.20.2.0
Dialog DLL:         TARMP.DLL              V1.51

Can anyone give me a clue, where I have missed something, or what can the cause of that exception?

I've run out ideas right now.

Thanks in advance
Hubert

  • Hi,
    one additional information:

    I start successfully another application with the same bootloader. That application doesn't need Ethernet. All initializations and settings of the applications are the same.

    regards
    Hubert

  • Got it! My that was a hard one!!!!

    The startup code of the boot loader entered the user mode, which inhibited the startup code of the application to set all the the stack pointers but the one of the user mode.

    The boot loader has to run in supervisor mode and mustn't change to user mode!

    To eliminate that behaviour I changed in the file LPC2300.s from the boot-loader the following:

    Use Supervisor stack instead of User Mode stack

    UND_Stack_Size  EQU     0x00000000
    SVC_Stack_Size  EQU     0x00000400
    ABT_Stack_Size  EQU     0x00000000
    FIQ_Stack_Size  EQU     0x00000000
    IRQ_Stack_Size  EQU     0x00000080
    USR_Stack_Size  EQU     0x00000000
    
    ISR_Stack_Size  EQU     (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ 
                             FIQ_Stack_Size + IRQ_Stack_Size)
    
                    AREA    STACK, NOINIT, READWRITE, ALIGN=3
    
    Stack_Mem       SPACE   SVC_Stack_Size
    __initial_sp    SPACE   ISR_Stack_Size
    
    Stack_Top
    


    Comment out the commandto enter User Mode and set Stack to Supervisor Stack

    ;  Enter User Mode and set its Stack Pointer
    ;                MSR     CPSR_c, #Mode_USR
                    IF      :DEF:__MICROLIB
    
                    EXPORT __initial_sp
    
                    ELSE
    
                    MOV     SP, R0
                    SUB     SL, SP, #SVC_Stack_Size
    
                    ENDIF
    

    But I really cannot explain why I am able to start another application with a boot-loader that enters user mode.

    Regards
    Hubert