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.

Simplified Blinky example dosn't reach main

Other Parts Discussed in Thread: HALCOGEN

Here is the code of the simplified Blinky example:

The code always goes to the address 0x04, where is no instruction instead to the main function.

Here is the code:

/*
 * main.c
 */

#include "hal_stdtypes.h"

typedef volatile struct gioPort
{
    uint32 DIR;    /**< 0x0000: Data Direction Register */
    uint32 DIN;    /**< 0x0004: Data Input Register */
    uint32 DOUT;   /**< 0x0008: Data Output Register */
    uint32 DSET;   /**< 0x000C: Data Output Set Register */
    uint32 DCLR;   /**< 0x0010: Data Output Clear Register */
    uint32 PDR;    /**< 0x0014: Open Drain Register */
    uint32 PULDIS; /**< 0x0018: Pullup Disable Register */
    uint32 PSL;    /**< 0x001C: Pull Up/Down Selection Register */
} gioPORT_t;

#define hetPORT1 ((gioPORT_t *)0xFFF7B84CU)

void gioSetDirection(gioPORT_t *port, uint32 dir)
{
    port->DIR = dir;
}

void gioSetPort(gioPORT_t *port, uint32 value)
{
/* USER CODE BEGIN (6) */
/* USER CODE END */

    port->DOUT = value;

/* USER CODE BEGIN (7) */
/* USER CODE END */

}

uint32 gioGetPort(gioPORT_t *port)
{
/* USER CODE BEGIN (9) */
/* USER CODE END */

    return port->DIN;
}


void main(void) {
    gioSetDirection(hetPORT1, 0xFFFFFFFF);
    gioSetPort(hetPORT1, gioGetPort(hetPORT1) ^ 0x00000001);
    while (1)
    {
        uint32 cycle = 16000000U;
        while ( cycle--){};
        gioSetPort(hetPORT1, gioGetPort(hetPORT1) ^ 0x00000001);
    }
    

}

In the dissasably window you can see that the program halts at 0x04:

->00000004:   FFFFFFFF                 .word   0xFFFFFFFF system hangs here, no instruction for processor!
00000008:   FFFFFFFF                 .word   0xFFFFFFFF
0000000c:   FFFFFFFF                 .word   0xFFFFFFFF
00000010:   FFFFFFFF                 .word   0xFFFFFFFF
00000014:   FFFFFFFF                 .word   0xFFFFFFFF
00000018:   FFFFFFFF                 .word   0xFFFFFFFF
0000001c:   FFFFFFFF                 .word   0xFFFFFFFF
          gioSetDirection:

here is the summary of compiler flags set:

-mv7R4 --code_state=32 --float_support=VFPv3D16 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/arm_4.9.9/include" --diag_warning=225 --display_error_number --enum_type=packed

and the summary of linker flags set:

-mv7R4 --code_state=32 --float_support=VFPv3D16 --abi=eabi -g --diag_warning=225 --display_error_number --enum_type=packed -z -m"LEDtest.map" -i"C:/ti/ccsv5/tools/compiler/arm_4.9.9/lib" -i"C:/ti/ccsv5/tools/compiler/arm_4.9.9/include" --reread_libs --warn_sections --display_error_number --rom_model --be32

I checked the blinky example code, but didn't find any initialisation missing, so what can be wrong??

  • Lutz,

    To me it looks like you're probably linking in the runtime support library's vector table which comes up empty.  The runtime support library that ships with the compiler is 'generic' and doesn't work well with the Hercules products when it comes to device init code and vector tables.  You should use these from HalCoGen instead

    If you need help fixing this please post your .map file so we can look at what's getting linked in.

    However, this error might typically be caused by the order of linking ... if you put the runtime library on the command line before the halcogen files it might do this.

  • 2845.LEDtest.zip

    Here is the according map file zipped. Looking forward for your analysis.

    Thanks in advance.

  • Lutz,

    It looks like you've got an undefined area where the interrupt vectors should go.
    Did you start with HalCoGen code as the basis ...

    If not then you are going to be missing a lot more than just the vectors - there's also critical startup steps required to sync up the two lockstep cores that you need and that will cause you a next set of problems.

    I'd suggest either using the HalCoGen code, or if you need to write your own code for some reason you'll need to spend quite some time w. these docs:  http://www.ti.com/lit/pdf/spna106 or http://www.ti.com/lit/pdf/spna163 depending on which device you are using.