⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
10 posts / 0 new
Last post
ddustin
Offline
Last seen:2个月前1年
Joined:2016-04-20 22:12
ROM vs RAM

When using Smart Snippets "ble_peripheral" project and the "QSPI" deployment method on the Dev Pro board, where is the program being stored?

它是否存储在RAM中,占用110kb的RAM(仅落户运行的15kb)或者它存储在其他地方?

How can I reduce the size of the used RAM such that mbedTLS has enough RAM to run?

设备:
PM_Dialog
Offline
Last seen:2天12小时前
Staff
Joined:2018-02-08 11:03
嗨Ddustin,

嗨Ddustin,

When you press the program_qspi_serial_win or program_qspi_jtag_win, the application code is stored into the QSPI Flash and not into the RAM. Since the code is not downloaded int the RAM, in case you want to have enough RAM for the mbedTLS, you should increase the available the available area of the RAM. So, I strongly recommend you to increase the total heap size, by configuring theconfigTOTAL_HEAP_SIZE在自定义宏custom_config_qspi.h头文件。

Thanks, PM_Dialog

ddustin
Offline
Last seen:2个月前1年
Joined:2016-04-20 22:12
.

.
Hi,

谢谢你的帮助!

Using the example project ble_peripheral, I increased the heap size as such:

#define configtotal_heap_size 40000 / *这是freertos total堆大小* /

When building I got this error:

建筑目标:ble_peripheral.ell
Invoking: Cross ARM C Linker
C:/ Diasemi / SmartsnippetsStudio / GCC / 4_9-2015Q1 / Bin /../ Lib / GCC / ARM-None-EABI / 4.9.3 /../../../../ ARM-None-EABI /bin / ld.exe:ble_peripheral.elf部分`Retention_ram0'不适合区域`retram0'
C:/ Diasemi / SmartsnippetsStudio / GCC / 4_9-2015Q1 / Bin /../ Lib / GCC / ARM-None-EABI / 4.9.3 /../../../../ ARM-None-EABI /bin/ld.exe: region `RetRAM0' overflowed by 19488 bytes
collect2.exe:错误:LD返回1个退出状态
make: *** [ble_peripheral.elf] Error 1

Lowering the heap size to 20,512 allows the program to compile however does not leave enough memory for mbedTLS to execute a basic 'crypto_asymmetric_key_pair_gen' operation.

ddustin
Offline
Last seen:2个月前1年
Joined:2016-04-20 22:12
.

.
Hm it may not be a memory issue anymore. It is crashing in a new place:

hw_watchdog_handle_int()在hw_watchdog.c:111 0x7fc4286
nmi_handlerc()在hw_watchdog.c:143 0x7fc42f2
()在0xffffff9
mbedtls_mpi_add_abs() at bignum.c:889 0x80011a8
ecp_mod_koblitz() at ecp_curves.c:1,271 0x8003030
ecp_mod_p256k1() at ecp_curves.c:1,322 0x800304e
ECP_MODP()在ECP.C:678 0x8001cc4
ecp_add_mixed() at ecp.c:1,048 0x800272e
ECP.C中的ECP_MUL_COMB_CORE():1,297 0x8002BE6
ecp_mul_comb() at ecp.c:1,400 0x8002be6
mbedtls_ecp_mul() at ecp.c:1,632 0x8002e72
mbedtls_ecp_gen_keypair_base() at ecp.c:1,892 0x8002efc
MBEDTLS_ECP_GEN_KEYPAIR()在ECP.C:1,903 0x8002F24
mbedtls_ecp_gen_key() at ecp.c:1,917 0x8002f4e
crypto_asymmetric_key_pair_gen()在bo_crypto.c:320 0x800e8d2
main()在main.c:129 0x800E9FA

What does this backtrace mean?

Edit: I believe I figured this out. I had modified the configTOTAL_HEAP_SIZE and also the __HEAP_SIZE. I believe malloc was returning invalid memory causing the crash.

#define configTOTAL_HEAP_SIZE 20512 /* This is the FreeRTOS Total Heap Size */
#define __heap_size 8000.

I'm guessing I shouldn't be modifying __HEAP_SIZE. What is the correct way to increase the available memory to use mbedTLS?

PM_Dialog
Offline
Last seen:2天12小时前
Staff
Joined:2018-02-08 11:03
嗨Ddustin,

嗨Ddustin,

Sorry but I am a little bit confused with your description. Could you please clarify if you solved your problem with changing the total heap size?

Thanks, PM_DIalog

ddustin
Offline
Last seen:2个月前1年
Joined:2016-04-20 22:12
没有问题仍然是

没有问题仍然是一样的。在将Crypto例程添加到BLE_Peripheral示例程序并使用ConfigtotAl_heap_size宏将其设置为20,000时,该程序仍然以暗示它不足的方式查找Crypto库中的内部。

Please help. How do I make a project with both the BLE stack and crypto routines?

PM_Dialog
Offline
Last seen:2天12小时前
Staff
Joined:2018-02-08 11:03
嗨Ddustin,

嗨Ddustin,

您应该将RAM的大小最小化到您可以编译项目的最小允许大小,并最大化堆大小为最大大小,例如70000,以增加分配的内存。因此,您应该增加堆大小并降低RAM大小。此外,您必须使用OS_FREE)_和OS_MALLOC()进行任务。请尝试一下,让我知道。

Thanks, PM_Dialog

ddustin
Offline
Last seen:2个月前1年
Joined:2016-04-20 22:12
我能够得到ble

我能够得到ble_peripheral example program working with crypto by turning off dg_configUSE_WDOG and erasing all uses of the watchdog.

What is this watchdog used for and why would it being enabled break the crypto routines?

PM_Dialog
Offline
Last seen:2天12小时前
Staff
Joined:2018-02-08 11:03
嗨Ddustin,

嗨Ddustin,

A watchdog mechanism is a special hardware timer that can be used to automatically detect unexpected system behaviors during software execution. The DA1468x family of devices incorporates an 8-bit down counter driven by a 10.24 ms clock pulse, resulting in a maximum 2.6 seconds time-out. For getting more information about the watchdog (WDOG) mechanism as implemented in the DA1468x family of devices, I would highly suggest you read the section5 Reboot Analysis - WDOGDebugging Techniques Tutorial (HTML)我们支持页面的教程。请注意,您可以在我们门户网站的DA14680选项卡中找到非常有用的文档。此外,强烈建议看看DA14680数据表,部分30 Watchdog Timer. So, the reason why your code gets stack when using crypto routines, is that something had been taken to long, more than the watchdog timeout. When you are using asynchronous events and you don’t know when you are going to receive them, the best practice is to freeze the WDOG until you get the event. Since you get it, you should activate and reload it again. In general, the WDOG is used in synchronous events. The WDOG is a counter that counts inverted and the firmware should reload it in regular time periods and before the time out. If you found any of the above answers useful please mark one of them as accepted.

Thanks, PM_Dialog

ddustin
Offline
Last seen:2个月前1年
Joined:2016-04-20 22:12
谢谢您的帮助!

谢谢您的帮助!