RESET_MEM_ALLOC_FAIL when calling attm_svc_create_db_128

4 posts / 0 new
Last post
zheshen
Offline
Last seen:1 year 7 months ago
Joined:2015-08-11 20:01
RESET_MEM_ALLOC_FAIL when calling attm_svc_create_db_128

你好我想以下模板的例子(empty_peripheral_template) by adding a DISS service and a custom service. The custom service has 4 characteristics with value lengths set at 20, 20, 250, 500 bytes. I got this reset code of RESET_MEM_ALLOC_FAIL when calling custs1_create_db_req_handler -> attm_svc_create_db_128 -> attmdb_add_service. If I change the length of the third characteristic from 250 to 200, the code runs fine.

My question is: how many combined bytes I can declare for all my characteristics ? I noticed that the firmware size is only about 15K so there should be plenty of room. Do I need to increase the heap size some where ?

Thanks,

Zhe

Device:
MT_dialog
Offline
Last seen:2 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi zheshen,

Hi zheshen,

The size of your database is limited by the database heap size, you can follow the below link to increase the size of your db heap.

http://support.dialog-semiconductor.com/increasing-dbheapsz

Thanks MT_dialog

zheshen
Offline
Last seen:1 year 7 months ago
Joined:2015-08-11 20:01
Hi MT_dialog,

Hi MT_dialog,

I followed the thread you provided above and changed DB_HEAP_SZ in da1458x_config_advance.h from 1024 to 2048 but it didn't help. In the .map file I found the following:

Base Addr Size Type Attr Idx E Section Name Object

0x00080768 0x0000040c Zero RW 516 heap_db_area jump_table.o
0x00080b74 0x00000154 Zero RW 517 heap_env_area jump_table.o
0x00080cc8 0x0000052c Zero RW 519 heap_msg_area jump_table.o

There seems to be no change in heap size allocated. I looked into the comments right above DB_HEAP_SZ and it seems to say if sleep mode is CFG_EXT_SLEEP or no sleep (which is what I configured) then the heap size is automatically calculated.

Search of declaration heap_db_area in the project seems to show that its size is determined by RWIP_HEAP_DB_SIZE_JT which is defined in em_map_ble.h:

#ifndef DB_HEAP_SZ
#define RWIP_HEAP_DB_SIZE_JT 1024 //IN BYTES
#else
#define RWIP_HEAP_DB_SIZE_JT DB_HEAP_SZ //IN BYTES
#endif

So if in no sleeping or ext sleep mode, since DB_HEAP_SZ is not defined, the heap size is automatically default to 1024. Otherwise it is set to whatever DB_HEAP_SZ is. My question is it OK to bump the constant 1024 above in em_map_ble.h to a higher value and not introduce trouble else where ?

Thanks,

Zhe

Joacimwe
Offline
Last seen:1 year 5 months ago
Guru
Joined:2014-01-14 06:45
Just place "#define DB_HEAP

Just place "#define DB_HEAP_SZ 2048" in da1458x_config_advanced.h outside the if-block so you make sure it is applied, and you'll be fine.