diff options
| author | sakumisu <[email protected]> | 2024-06-22 18:46:02 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2024-06-22 19:33:43 +0800 |
| commit | 0f8ec31981f3c8a0b3099e2cada5680f9d5694e1 (patch) | |
| tree | 506044a52ead6f53914d0a246cfc7224a8c31c9c /docs/source/quick_start | |
| parent | 3bf74d210189270a4adacf6124f4e0d9e9fb87c0 (diff) | |
update rst for malloc free
Diffstat (limited to 'docs/source/quick_start')
| -rw-r--r-- | docs/source/quick_start/other_chip.rst | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/docs/source/quick_start/other_chip.rst b/docs/source/quick_start/other_chip.rst index cb0832c7..ada557dc 100644 --- a/docs/source/quick_start/other_chip.rst +++ b/docs/source/quick_start/other_chip.rst @@ -1,7 +1,22 @@ 芯片通用移植指南 ========================= -本节主要介绍所有带 USB IP 的芯片,移植 CherryUSB 主从协议栈时的通用步骤和注意事项。在往下看之前,需要 **你准备好一个可以打印 helloworld 的基本工程** ,并且实现了 `printf` 、 `malloc`、 `free`。如果是主机,需要 **准备好可以打印 helloworld 的带 OS 的工程**。 +本节主要介绍所有带 USB IP 的芯片,移植 CherryUSB 主从协议栈时的通用步骤和注意事项。在往下看之前,需要 **你准备好一个可以打印 helloworld 的基本工程** ,并且实现了 `printf` 、 `malloc`、 `free`。如果是主机,需要 **准备好可以打印 helloworld 的带 OS 的工程**。通常来说, `printf` 大家都会实现, +`malloc`、 `free` 主要给主机使用, 默认 config 文件使用的就是 `malloc`、 `free`,推荐修改为 os 相关接口, 不推荐使用系统库,尤其是 keil 自带的这种。举例如下: + +.. code-block:: C + + // default config + #define usb_malloc(size) malloc(size) + #define usb_free(ptr) free(ptr) + + // freertos + #define usb_malloc(size) pvPortMalloc(size) + #define usb_free(ptr) vPortFree(ptr) + + //rtthread + #define usb_malloc(size) rt_malloc(size) + #define usb_free(ptr) rt_free(ptr) USB Device 移植要点 ----------------------- |
