Hello Yogesh,

The idle task is not intended to be used by user application code.
Do whatever you need to do in main or other tasks.
The Idle task has minimal stack size which is not enough for printf.

Print hello in main task.

br
Jerzy


pt., 7 sie 2020 o 22:39 Yogesh Balasaheb Yadav
<yogesh...@pathpartnertech.com> napisaƂ(a):
>
> Hi,
> I am working on porting Mynewt RTOS on nucleo-l55ze (Cortex-m33) board,and
> able to build blinky and load.but led will blink only once and observed the
> issue that is unhandled interrupt/exception generated while context
> switching between main task to idle task,that's why proper execution is not
> happening.
> *I need some help on why such a undefined exception occurred or code
> crashes ?*
> following are steps followed:
> *step 1 :Initial loading of .elf works fine*
> Reading symbols from
> bin/targets/nucleo-l552ze_slinky/app/apps/blinky/blinky.elf...
> HAL_GetTick () at
> repos/apache-mynewt-core/hw/mcu/stm/stm32_common/src/hal_system.c:47
> 47 {
> target halted due to debug-request, current mode: Thread
> xPSR: 0xf9000000 pc: 0x080001f4 msp: 0x20018000
> (gdb) load
> Loading section .text, size 0x3d34 lma 0x8010020
> Loading section .ARM.exidx, size 0x18 lma 0x8013d54
> Loading section .data, size 0x60 lma 0x8013d6c
> Start address 0x8010214, load size 15788
> Transfer rate: 20 KB/sec, 5262 bytes/write.
> (gdb) b main
> Breakpoint 1 at 0x80103ac: file apps/blinky/src/main.c, line 46.
> (gdb) b os_idle_task
> Breakpoint 2 at 0x801086c: file
> repos/apache-mynewt-core/kernel/os/src/os.c, line 87.
> (gdb) b os_default_irq_asm
> Breakpoint 3 at 0x801181a: file
> repos/apache-mynewt-core/kernel/os/src/arch/cortex_m33/m33/HAL_CM33.s, line
> 256.
> (gdb) c
> Continuing.
>
>
> *step 2 :Execution of main.c also working fine while execute once and led
> blinks for single time*
>  int
> main(int argc, char **argv)
> {
>     int rc;
> #ifdef ARCH_sim
>     mcu_sim_parse_args(argc, argv);
> #endif
>     sysinit();
>     g_led_pin = LED_BLINK_PIN;
>     hal_gpio_init_out(g_led_pin, 1);
>     while (1) {
>         ++g_task1_loops;
>         /* Wait one second */
>         os_time_delay(OS_TICKS_PER_SEC);
>         /* Toggle the LED */
>         hal_gpio_toggle(g_led_pin);
>     }
>     assert(0);
>     return rc;
> }
>
> *step 3 :when context switched to os_idle_task it get proper address and
> control goes to os_idle_task*
> void
> os_idle_task(void *arg)
> {
>     os_sr_t sr;
>     os_time_t now;
>     os_time_t iticks, sticks, cticks;
>     os_time_t sanity_last;
>     os_time_t sanity_itvl_ticks;
>     sanity_itvl_ticks = (MYNEWT_VAL(SANITY_INTERVAL) * OS_TICKS_PER_SEC) /
> 1000;
>     sanity_last = 0;
> printf("hello\n");
>     hal_watchdog_tickle();
> #if MYNEWT_VAL(OS_WATCHDOG_MONITOR)
>     os_cputime_timer_stop(&os_wdog_monitor);
>     os_cputime_timer_relative(&os_wdog_monitor, OS_WDOG_MONITOR_TMO);
> #endif
>     while (1) {
> ;;;
> following is the assembly instruction inside os_idle_task that execute and
> code crash ,
> void
> os_idle_task(void *arg)
> {
>  *801086c:       b5f8            push    {r3, r4, r5, r6, r7, lr}*
>   ...
> after executing above instruction code control goes to default irq
> instruction shown in step 4
> *step 4:but instead of entering into os_idle_task execution some exception
> generate and control goes to*
>         TST     LR,#4
>         ITE     EQ
>         MRSEQ   R3,MSP
>         MRSNE   R3,PSP
>         PUSH    {R3-R11,LR}
>         MOV     R0, SP
>         BL      os_default_irq
>
> Below are some link for reference which include all file and dependency
> used for development,
> compiler related file :
> https://github.com/apache/mynewt-core/tree/master/compiler/arm-none-eabi-m33
> cortex-m33 related compilation file :
> https://github.com/apache/mynewt-core/tree/master/kernel/os/include/os/arch/cortex_m33/os
> MCU Package(HAL, Low-Layer APIs and CMSIS) file :
> https://www.st.com/en/embedded-software/stm32cubel5.html
>
> --
>
>
>
>
>
>
> This
> message contains confidential information and is intended only
> for the
> individual(s) named. If you are not the intended
> recipient, you are
> notified that disclosing, copying, distributing or taking any
> action in
> reliance on the contents of this mail and attached file/s is strictly
>
> prohibited. Please notify the
> sender immediately and delete this e-mail
> from your system. E-mail transmission
> cannot be guaranteed to be secured or
> error-free as information could be
> intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain
> viruses. The sender therefore does
> not accept liability for any errors or
> omissions in the contents of this
> message, which arise as a result of e-mail
> transmission.

Reply via email to