exception at 4000df2f (memcmp)

Posts: 5
Joined: Sun Sep 13, 2015 11:52 pm

exception at 4000df2f (memcmp)

Postby st0ff3r » Sat Nov 17, 2018 8:49 pm

reason=2 exccause=28 epc1=0x4000df2f epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000033 depc=0x00000000

anyone know why app.map contains both

PROVIDE (ets_memcmp, 0x400018d4)
PROVIDE (memcmp, 0x4000dea8)

are those not the same?

include/platform.h says
#define memcmp(a, b, c) os_memcmp(a, b, c)

my code is at https://github.com/nabovarme/MeterLogge ... pto.c#L109

Posts: 59
Joined: Sun May 03, 2015 5:36 pm

Re: exception at 4000df2f (memcmp)

Postby YimingLi » Thu Sep 26, 2019 6:45 pm


First, memcmp() and os_memcmp()/est_memcmp() are de-facto the same from point of brom, since the implementation of ets_memcmp() is something like below:

int ets memcmp(void *addr1, void *addr2, size_t n)
memcmp(addr1, addr2, n);
#define os_memcmp ets_memcmp

Similar the case is memcpy() and os_memcpy()/ets_memcpy(). Therefore, if an exception occurs at an address inside/following memcpy(), it might be caused by a call of os_memcpy()/ets_memcpy().

Second, 0x4000df2f is a branch address neither by/inside memcmp() nor by/inside ets_memcmp(), But is an address related to memcpy() or ets_memcpy/os_memcpy() de-facto which is called.

1. 0x4000df2f is a branch address when the brom code memcpy(dest_addr, src_addr, length)/os_memcpy()/ets_memcpy() is called
2, Exception 28 caused at 0x4000df2f with excvaddr=0x00000033 indicates below:
(1) excvaddr=0x00000033 indicates that memcpy(dest_addr, src_addr, length) is called with src_addr=0x00000033, which is an address load prohibited.
(2) exception cause at 0x4000df2f indicates that memcpy(dest_addr, src_addr, length), or os_memcpy(), or ets_memcpy() is called with dest_addr of 2-byte aligned but not 4-byte aligned (e.g. dest_dest = 0x3fff2014), and the length >= 6.

So, please check your code with all memcpy() or os_memcpy() or ets_memcpy(), especially with those possible src_addr=0x33 and length>=6 (ignoring thoese calling with length=4 for an example), and dest_addr is 2-bytes aligned(ignore those calling with odd dest_addr or 4-byte aligned dest_addr).

Hope it would be helpful for you!

ALK8266WIFI Module Extends MCU Capabilities to Tranceive in an efective speed of 1+MBytes/s
English: https://www.ebay.com/itm/283536362871
中文: https://item.taobao.com/item.htm?id=576141575067

Who is online

Users browsing this forum: No registered users and 7 guests