From 025f49d228ac9e4a1a7c45ea121330d74bf3bdc5 Mon Sep 17 00:00:00 2001
From: Dong Heng <dongheng@espressif.com>
Date: Fri, 27 Apr 2018 17:26:51 +0800
Subject: [PATCH] feat(freertos): Initialize cpu_sr when FreeRTOS core call
 port function xPortStartScheduler

---
 components/freertos/port/port.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/components/freertos/port/port.c b/components/freertos/port/port.c
index 49a25b9f..7cbb2684 100644
--- a/components/freertos/port/port.c
+++ b/components/freertos/port/port.c
@@ -176,6 +176,16 @@ void xPortSysTickHandle(void)
 portBASE_TYPE ICACHE_FLASH_ATTR
 xPortStartScheduler(void)
 {
+    /*
+     * TAG 1.2.3 FreeRTOS call "portDISABLE_INTERRUPTS" at file tasks.c line 1973, this is not at old one.
+     * This makes it to be a wrong value.
+     * 
+     * So we should initialize global value "cpu_sr" with a right value.
+     * 
+     * Todo: Remove this one when refactor startup function.
+     */
+    cpu_sr = 0x20;
+
     /*******software isr*********/
     _xt_isr_attach(ETS_SOFT_INUM, SoftIsrHdl, NULL);
     _xt_isr_unmask(1 << ETS_SOFT_INUM);