[delete]Uart stops working after ASM function call

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

[delete]Uart stops working after ASM function call

Postby Vader_Mester » Sun Nov 04, 2018 5:51 pm

[NO LONGER RELEVANT, CAN BE DELETED]

Hi All,

So I'm sure my issue here is quite new for most people, but I've got nowhere to go to, so here it goes.

I'm making an Assembly code function for some RGB mixing with some transparency, and I'm currently testing the code to see if it actually works properly.

During my testing (with any of my functions), I ran into the issue, that after my function that has the assembly code is called, uart stops sending anything, although the program keeps working correctly (I modified the Hello_World example and after the function call comes the 10 second countdown and reset which nicely works).

Anybody have any idea how can I solve this?

Questions may be asked:
1) IDF version: Latest IDF, just reinstalled the entire toolchain and IDF fresh yesterday

2) Q: What If I don't use it as inline function
A: Already tried it, that was the first thing I did, then set the thing as inline to see if it solve it, but nope :)

3) Q: Have you tried other assembly codes?
A: Actually I experienced this with other functions during the beggining of my testing.

Code here.
argb_asm.zip
(17.97 MiB) Downloaded 380 times
Last edited by Vader_Mester on Tue Nov 06, 2018 12:52 pm, edited 2 times in total.

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: Uart stops working after ASM function call

Postby Vader_Mester » Mon Nov 05, 2018 12:15 pm

One thing I just notice is that the chip keeps resetting because of WDT, not with the 10sec countdown (that I previously assumed).
So something is happening during the assembly routine.

I even modified the code to place the function into IRAM rather than inline, but no change.

The only thing left is to use the "ILL" insturction (Garanteed illegal instruction :) )to panic the core and generate a core dump to see where does it goes wrong.

Code: Select all

ets Jun  8 2016 00:22:57
11:24:07.808 -> 
11:24:07.808 -> rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
11:24:07.808 -> configsip: 0, SPIWP:0xee
11:24:07.808 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
11:24:07.841 -> mode:DIO, clock div:1
11:24:07.841 -> load:0x3fff0018,len:4
11:24:07.841 -> load:0x3fff001c,len:6588
11:24:07.841 -> load:0x40078000,len:10976
11:24:07.841 -> load:0x40080400,len:7184
11:24:07.841 -> entry 0x40080780
11:24:07.841 -> [0;33mW (58) boot: PRO CPU has been reset by WDT.[0m
11:24:07.841 -> [0;33mW (58) boot: WDT reset info: PRO CPU PC=0x40088b9b[0m
11:24:07.841 -> [0;33mW (58) boot: WDT reset info: APP CPU PC=0x4008778b[0m
11:24:07.875 -> [0;32mI (64) boot: ESP-IDF v3.2-beta1-15-g12b2268ee 2nd stage bootloader[0m
11:24:07.875 -> [0;32mI (71) boot: compile time 19:50:21[0m
11:24:07.875 -> [0;32mI (75) boot: Enabling RNG early entropy source...[0m
11:24:07.875 -> [0;32mI (80) qio_mode: Enabling default flash chip QIO[0m
11:24:07.875 -> [0;32mI (86) boot: SPI Speed      : 80MHz[0m
11:24:07.875 -> [0;32mI (90) boot: SPI Mode       : QIO[0m
11:24:07.875 -> [0;32mI (94) boot: SPI Flash Size : 4MB[0m
11:24:07.909 -> [0;32mI (98) boot: Partition Table:[0m
11:24:07.909 -> [0;32mI (101) boot: ## Label            Usage          Type ST Offset   Length[0m
11:24:07.909 -> [0;32mI (109) boot:  0 nvs              WiFi data        01 02 00009000 00006000[0m
11:24:07.909 -> [0;32mI (116) boot:  1 phy_init         RF data          01 01 0000f000 00001000[0m
11:24:07.909 -> [0;32mI (124) boot:  2 factory          factory app      00 00 00010000 00100000[0m
11:24:07.943 -> [0;32mI (132) boot: End of partition table[0m
11:24:07.943 -> [0;32mI (136) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x07698 ( 30360) map[0m
11:24:07.943 -> [0;32mI (153) esp_image: segment 1: paddr=0x000176c0 vaddr=0x3ff80000 size=0x00000 (     0) load[0m
11:24:07.943 -> [0;32mI (154) esp_image: segment 2: paddr=0x000176c8 vaddr=0x3ff80000 size=0x00000 (     0) load[0m
11:24:07.943 -> [0;32mI (163) esp_image: segment 3: paddr=0x000176d0 vaddr=0x3ffb0000 size=0x01e98 (  7832) load[0m
11:24:07.977 -> [0;32mI (174) esp_image: segment 4: paddr=0x00019570 vaddr=0x3ffb1e98 size=0x00000 (     0) load[0m
11:24:07.977 -> [0;32mI (180) esp_image: segment 5: paddr=0x00019578 vaddr=0x40080000 size=0x00400 (  1024) load[0m
11:24:07.977 -> [0;32mI (190) esp_image: segment 6: paddr=0x00019980 vaddr=0x40080400 size=0x06690 ( 26256) load[0m
11:24:08.011 -> [0;32mI (207) esp_image: segment 7: paddr=0x00020018 vaddr=0x400d0018 size=0x124a0 ( 74912) map[0m
11:24:08.011 -> [0;32mI (227) esp_image: segment 8: paddr=0x000324c0 vaddr=0x40086a90 size=0x02a38 ( 10808) load[0m
11:24:08.011 -> [0;32mI (231) esp_image: segment 9: paddr=0x00034f00 vaddr=0x400c0000 size=0x00000 (     0) load[0m
11:24:08.046 -> [0;32mI (234) esp_image: segment 10: paddr=0x00034f08 vaddr=0x50000000 size=0x00000 (     0) load[0m
11:24:08.046 -> [0;32mI (243) esp_image: segment 11: paddr=0x00034f10 vaddr=0x50000000 size=0x00000 (     0) load[0m
11:24:08.046 -> [0;32mI (258) boot: Loaded app from partition at offset 0x10000[0m
11:24:08.046 -> [0;32mI (258) boot: Disabling RNG early entropy source...[0m
11:24:08.046 -> [0;32mI (264) cpu_start: Pro cpu up.[0m
11:24:08.079 -> [0;32mI (267) cpu_start: Starting app cpu, entry point is 0x40080ea4[0m
11:24:08.079 -> [0;32mI (0) cpu_start: App cpu up.[0m
11:24:08.079 -> [0;32mI (277) heap_init: Initializing. RAM available for dynamic allocation:[0m
11:24:08.079 -> [0;32mI (284) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM[0m
11:24:08.079 -> [0;32mI (290) heap_init: At 3FFB2EE0 len 0002D120 (180 KiB): DRAM[0m
11:24:08.079 -> [0;32mI (297) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM[0m
11:24:08.112 -> [0;32mI (303) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
11:24:08.112 -> [0;32mI (310) heap_init: At 400894C8 len 00016B38 (90 KiB): IRAM[0m
11:24:08.112 -> [0;32mI (316) cpu_start: Pro cpu start user code[0m
11:24:08.112 -> [0;32mI (333) cpu_start: Starting scheduler on PRO CPU.[0m
11:24:08.112 -> [0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
11:24:08.146 -> Hello world!
11:24:08.146 -> This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash
11:24:08.146 -> fgc: 5500ffff
11:24:08.146 -> bgc: ff0000
11:24:08.146 -> fg_A: 55
11:24:08.146 -> fg_Ai: aa
11:24:08.146 -> fg_R: 0
11:24:08.146 -> fg_G: ff
11:24:08.146 -> fg_B: ff
11:24:08.146 -> bg_R: ff
11:24:08.146 -> bg_G: 0
11:24:08.146 -> bg_B: 0
ets Jun  8 2016 00:22:57
11:24:18.112 -> 
11:24:18.112 -> rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Cimby1 and 107 guests