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.

Booster Sharp96 Example Code Compiled with GCC Never Reaches Main() - Generates Continuous resetISR() CCS V6.0.1 GCC 4.8.4

CCS V6.0.1  GCC 4.8.4        Windows 7 64 bit     MSP432 Launchpad

resetISR() gets triggered as soon as zero filling .bss code executes first line of code and never makes it to Main();

Seems like either WDT timeout or Invalid Stack situation.

Any help would be greatly appreciated. 

-----------------------------------------------------------------------------------------------

MEMORY
{
    MAIN_FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00040000
    INFO_FLASH (RX) : ORIGIN = 0x00200000, LENGTH = 0x00004000
    SRAM_CODE  (RWX): ORIGIN = 0x01000000, LENGTH = 0x00010000
    SRAM_DATA  (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
}

REGION_ALIAS("REGION_TEXT", MAIN_FLASH);
REGION_ALIAS("REGION_BSS", SRAM_DATA);
REGION_ALIAS("REGION_DATA", SRAM_DATA);
REGION_ALIAS("REGION_STACK", SRAM_DATA);
REGION_ALIAS("REGION_HEAP", SRAM_DATA);
REGION_ALIAS("REGION_ARM_EXIDX", MAIN_FLASH);
REGION_ALIAS("REGION_ARM_EXTAB", MAIN_FLASH);

SECTIONS {

    PROVIDE (_intvecs_base_address = 0x0);

    .intvecs (_intvecs_base_address) : AT (_intvecs_base_address) {
        KEEP (*(.intvecs))
    } > REGION_TEXT

    PROVIDE (_vtable_base_address = 0x0);

    .vtable (_vtable_base_address) : AT (_vtable_base_address) {
        KEEP (*(.vtable))
    } > REGION_DATA

    .text : {
        CREATE_OBJECT_SYMBOLS
        KEEP (*(.text))
        *(.text.*)
        . = ALIGN(0x4);
        KEEP (*(.ctors))
        . = ALIGN(0x4);
        KEEP (*(.dtors))
        . = ALIGN(0x4);
        __init_array_start = .;
        KEEP (*(.init_array*))
        __init_array_end = .;
        *(.init)
        *(.fini*)
    } > REGION_TEXT

    .rodata : {
        *(.rodata)
        *(.rodata.*)
    } > REGION_TEXT

    .ARM.exidx : {
        __exidx_start = .;
        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
        __exidx_end = .;
    } > REGION_ARM_EXIDX

    .ARM.extab : {
        *(.ARM.extab* .gnu.linkonce.armextab.*)
    } > REGION_ARM_EXTAB

 /*   __etext = .;  */
     __data_load__ = .;

    .data : {
        __data_load__ = LOADADDR (.data);
        __data_start__ = .;
        KEEP (*(.data))
        KEEP (*(.data*))
        . = ALIGN (4);
        __data_end__ = .;
    } > REGION_DATA AT> REGION_TEXT

    .bss : {
        __bss_start__ = .;
        *(.shbss)
        KEEP (*(.bss))
        *(.bss.*)
        *(COMMON)
        . = ALIGN (4);
        __bss_end__ = .;
    } > REGION_BSS

    .heap : {
        __heap_start__ = .;
        end = __heap_start__;
        _end = end;
        __end = end;
        KEEP (*(.heap))
        __heap_end__ = .;
        __HeapLimit = __heap_end__;
    } > REGION_HEAP

    .stack : ALIGN(0x8) {
        _stack = .;
        __stack = .;
        KEEP(*(.stack))
    } > REGION_STACK
}

-----------------------------------------------------------------------------------------------
void (* const interruptVectors[])(void) __attribute__ ((section (".intvecs"))) =
{
    (void (*)(void))((uint32_t)0x20004000),
                                            /* The initial stack pointer */
    resetISR,                               /* The reset handler         */
    nmiISR,                                 /* The NMI handler           */
    faultISR,                               /* The hard fault handler    */
    defaultISR,                             /* The MPU fault handler     */
    defaultISR,                             /* The bus fault handler     */
    defaultISR,                             /* The usage fault handler   */
    0,                                      /* Reserved                  */
    0,                                      /* Reserved                  */
    0,                                      /* Reserved                  */
    0,                                      /* Reserved                  */
    defaultISR,                             /* SVCall handler            */
    defaultISR,                             /* Debug monitor handler     */
    0,                                      /* Reserved                  */
    defaultISR,                             /* The PendSV handler        */
    defaultISR,                             /* The SysTick handler       */
    defaultISR,                             /* PSS ISR                   */
    defaultISR,                             /* CS ISR                    */
    defaultISR,                             /* PCM ISR                   */
    defaultISR,                             /* WDT ISR                   */
    defaultISR,                             /* FPU ISR                   */
    defaultISR,                             /* FLCTL ISR                 */
    defaultISR,                             /* COMP0 ISR                 */
    defaultISR,                             /* COMP1 ISR                 */
    defaultISR,                             /* TA0_0 ISR                 */
    defaultISR,                             /* TA0_N ISR                 */
	TimerA1_0IsrHandler,                    /* TA1_0 ISR                 */
    defaultISR,                             /* TA1_N ISR                 */
    defaultISR,                             /* TA2_0 ISR                 */

-----------------------------------------------------------------------------------------------

void resetISR(void)
{
    /* Copy the data segment initializers from flash to SRAM. */
	unsigned long *pui32Src, *pui32Dest;
    pui32Src = &__data_load__;
    for(pui32Dest = &__data_start__; pui32Dest < &__data_end__; )
    {
       *pui32Dest++ = *pui32Src++;
    }

    /* Zero fill the bss segment. */
    __asm("    ldr     r0, =__bss_start__\n"      <---------- restISR() triggers when executing here
          "    ldr     r1, =__bss_end__\n"
          "    mov     r2, #0\n"
          "    .thumb_func\n"
          "zero_loop:\n"
          "        cmp     r0, r1\n"
          "        it      lt\n"
          "        strlt   r2, [r0], #4\n"
          "        blt     zero_loop");
 
    /* Call the application's entry point. */
    main();
}

map_file.zip

  • Thanks for the quick reply - I have already set the -e to _start in CCS under the Linker -> basics -> "set the address" line and it looks like it shows up in the .map file ok - I also have tried the ENTRY(resetISR) in the script file without any success
  • CURT WALKER said:
    resetISR() gets triggered as soon as zero filling .bss code executes first line of code and never makes it to Main(); Seems like either WDT timeout or Invalid Stack situation.

    I tried to repeat the problem by importing the 430BOOST-SHARP96_GrlibExample_MSP432P401R project into CCS 6.1.0.00104 and changing the compiler from the TI ARM compiler to GNU v4.8.4. However, couldn't repeat the problem in that the program runs successfully.

    The project is attached 430BOOST-SHARP96_GrlibExample_MSP432P401R.zip

    The Debug configuration uses the TI ARM compiler, and the Debug__GNU configuration uses the GNU compiler.

  • I loaded your project and it works fine - I must have something setup wrong in CCS - anyway to easily compare CCS project properties ?
    I would like to try using sharps larger 240x400 pixel display, but if I increase unsigned char DisplayBuffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX/8]; from 96x96 to 240x400 (12,000 Unsigned char) I also get a resetISR() generated
  • CURT WALKER said:
    I must have something setup wrong in CCS - anyway to easily compare CCS project properties ?

    The .ccsproject, .cproject and .project files are XML and so can be compared as text. However Eclipse tends to insert some unique (random?) suffices to the names of toolchain options, which can make it difficult to compare differences.

    One other option is to compare the "Summary of flags set" from the CCS Project properties under Build -> GNU Compiler and Build -> GNU Linker between two projects, which shows the compiler and linker command line options.

    CURT WALKER said:
    I would like to try using sharps larger 240x400 pixel display, but if I increase unsigned char DisplayBuffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX/8]; from 96x96 to 240x400 (12,000 Unsigned char) I also get a resetISR() generated

    That increases the size of the .bss segment which needs to be zero-initialized, which may cause the watchdog to trip during zeroing of the .bss segment.

    Try putting a call to WDT_A_holdTimer() at the start of the resetISR function in msp432_startup_ccs_gcc.c.

  • Chester Gillon said:
    The project is attached (Please visit the site to view this file)

    Looking at the resetISR function in the msp432_startup_ccs_gcc.c source file shows there is no code to copy the data segment initializers from flash to SRAM:

    void resetISR(void)
    {
        /* Copy the data segment initializers from flash to SRAM. */
    
        /* Zero fill the bss segment. */

    The missing code should be added as suggested in msp432_startup_ccs_gcc.c in CCS 6.1.0.00104 is missing code to copy the data segment initializers from flash to SRAM. The missing code could be causing other failures, as the .data segment will not be initialized correctly.

  • Thank you very much for all your help - greatly appreciated
  • I had this problem also.  As suggested, adding a call to  WDT_A_holdTimer() solved the problem for me.  I was incrementally developing code, guess I added just enough variables to result in the initialization taking too long.  I can't say I understand this processor very well yet, but I'm surprised that the default power-up condition for the watchdog timer would be 'enabled'.