AnsweredAssumed Answered

stuck on boot.S MQX-SDK with Processo Expert

Question asked by Massimiliano Sturla on Oct 13, 2014
Latest reply on Nov 19, 2014 by Radek Sestak

Hi to all!

i have a problem: I'm using FRDM-K64 with MQX-SDK 1.0.0. I develop with KDS 1.1.1

I created a new project with Processor Expert and add MQX component

All work well, now I tryied to use printf adding #include <stdio.h> and move the UART0 from prin 14-15 to pin 16-17, I recompile all and when debug the default breackpoint stop on main.c at   PE_low_level_init(); I try to run but it stop in the file:

 

boot.S

 

on line:

 

ldr r0, =NVIC_ICER0


and when I press "go" my code run and return to this point...

 

I try to delete the include and printf reference and restore original pin on 14-15 for UART0

 

my boot.S (never modified):

 

#include "asm_mac.h"

#include "mqx_cnfg.h"

#include "types.inc"

#include "psp_prv.inc"

 

 

#define __ASM__

 

 

#include "psp_cpu.h"

 

 

#undef __ASM__

 

 

    ASM_COMP_SPECIFIC_DIRECTIVES

    ASM_CODE_SECTION(.text)

    SET_FUNCTION_ALIGNMENT

 

 

    ASM_PUBLIC(__boot)

 

 

/*FUNCTION*-------------------------------------------------------------------

 

 

Function Name    : __boot

Returned Value   :

Comments         : startup sequence

 

 

END*-----------------------------------------------------------------------*/

 

 

ASM_EQUATE(NVIC_ICER0, 0xE000E180)

ASM_EQUATE(NVIC_ICPR0, 0xE000E280)

 

 

 

 

    ASM_PUBLIC_BEGIN(__boot)

    ASM_PUBLIC_FUNC(__boot)

ASM_LABEL(__boot)

 

 

#if MQX_AUX_CORE

        msr MSP, r0

        isb #15

#endif

 

 

        /* Disable interrupts and clear pending flags */

        ldr r0, =NVIC_ICER0

        ldr r1, =NVIC_ICPR0

        ldr r2, =0xFFFFFFFF

        mov r3, #8

 

 

ASM_LABEL(_boot_loop)

        cbz r3, _boot_loop_end

        str r2, [r0], #4        /* NVIC_ICERx - clear enable IRQ register */

        str r2, [r1], #4        /* NVIC_ICPRx - clear pending IRQ register */

        sub r3, r3, #1

        b _boot_loop

 

 

ASM_LABEL(_boot_loop_end)

 

 

        /* Prepare process stack pointer */

        mrs r0, MSP

        msr PSP, r0

 

 

        /* Switch to proccess stack (PSP) */

        mrs r0, CONTROL

        orr r0, r0, #2

        msr CONTROL, r0

        isb #15

 

 

#if MQXCFG_ENABLE_FP && PSP_HAS_FPU

        /* CPACR is located at address 0xE000ED88 */

        LDR.W   R0, =0xE000ED88

        /* Read CPACR */

        LDR     R1, [R0]

        /* Set bits 20-23 to enable CP10 and CP11 coprocessors */

        ORR     R1, R1, #(0xF << 20)

        /* Write back the modified value to the CPACR */

        STR     R1, [R0]

        /* turn off fpu register stacking in exception entry */

 

 

        ldr r0, =0xE000EF34     /* FPCCR */

        mov r1, #0

        str r1, [r0]

#endif

 

 

        /* Perform toolchain startup routines */

        ASM_EXTERN(toolchain_startup)

        b ASM_PREFIX(toolchain_startup)

 

 

    ASM_PUBLIC_END(__boot)


        ASM_ALIGN(4)

        ASM_END

 

when I compile I have a problem on PSP with asm volatile and I change two line in file "psp_supp.c" in this way:


 

 

uint16_t _psp_swap2byte(uint16_t n)

{

    uint16_t ret;

 

 

    //asm volatile ("rev16 %0, %1" :"=r" (ret):"r" (n));

    __ASM volatile("rev16 %0, %1" :"=r" (ret):"r" (n));

    return(ret);

}

 

 

/*!

* \brief Swap 4 bytes

*

* \param n

*

* \return uint32_t

*/

uint32_t _psp_swap4byte(uint32_t n)

{

    uint32_t ret;

 

 

    //asm volatile ("rev %0, %1" :"=r" (ret):"r" (n));

    __ASM volatile("rev %0, %1" :"=r" (ret):"r" (n));

    return(ret);

}

 

but after this modify the compile work and my code run, the problem occours when I try to use printf...

 

 

What i can do?!

Many thanks

Outcomes