Ameba-D Application Note RTL8722DM Build and Debug Environment Setup – IAR This document illustrates how to build Realtek low power Wi-Fi software under IAR SDK environment. Application Note All information provided in this document is subject to legal disclaimers. 1 © REALTEK 2020. All rights reserved.
Ameba-D Application Note 1 IAR Build Environment Setup This chapter illustrates how to setup IAR development environment for Realtek Ameba-D SDK, including building projects, downloading images and debugging. 1.1 Requirement 1.1.1 IAR Embedded Workbench IAR provides an IDE environment for code building, downloading, and debugging. Check “IAR Embedded Workbench” on http://www.iar.com/, and a trail version is available for 30 days.
Ameba-D Application Note 1.2.1 Antenna description The DUT has three types of antennas, both of which are 2.4 & 5GHz dual band antennas. The information is as follows. PIFA & Dipole antennas are connected with module by IPEX. 1) PCB Onboard Antenna, 2.4G peak gain 4.1dbi, 5G peak gain 3.9dbi. 2) PIFA Antenna, 2.4G peak gain 3.5dbi, 5G peak gain 5dbi. 3) Dipole Antenna, 2.4G peak gain 3dbi, 5G peak gain 5dbi. 1.2.
Ameba-D Application Note GND 13 14 11 12 9 10 TCK 7 8 TMS 5 6 TDO 3 4 TDI 1 2 TRST JRST RLX Probe Fig 1-4 RLX Probe and SWD connection diagram Fig 1-5 RLX Probe and Ameba-D SWD connection 1.3 How to Use IAR SDK? 1.3.1 IAR Project Introduction Because Ameba-D is a dual-core CPU platform, two workspaces are provided to build for each core in project\realtek_amebaD_va0_example\EWARM-RELEASE. Project_lp_release.
Ameba-D Application Note 3 km4_secure km4_application - is (mp ) km4_application - tz (mp) km4_secure - tz km4_secure - tz (mp) N Y Y Y Y Y N Y Note: 1. The configuration items with “-is” are ignore secure configuration, which are designed for applications that do not use TrustZone. 2. The configuration items with “-tz” are TrustZone configuration, which are designed for applications that use TrustZone. 3.
Ameba-D Application Note Fig 1-7 KM0 processor options Fig 1-8 Building KM0 project Application Note All information provided in this document is subject to legal disclaimers. 6 © REALTEK 2020. All rights reserved.
Ameba-D Application Note Note: After building each project, IAR will pop up a command prompt window to execute post-build action to generate images from executable files. This may takes several seconds. Don’t stop it while it is in progress. After post-build action is completed, the window would disappear automatically. (4) After compile, the images km0_boot_all.bin and km0_image2_all.bin can be seen in project\realtek_amebaD_va0_example\EWARMRELEASE\Debug\Exe\km0_image. 1.3.2.
Ameba-D Application Note (4) Right click the project and choose “Rebuild All”, as Fig 1-10 shows. The km4_bootloader, km4_secure and km4_application should compile in order. Fig 1-10 Building KM4 project Note: When TrustZone is enable, the km4_secure project must be built before the km4_application project. When TrustZone is not used, there is no need to compile the km4_secure project.
Ameba-D Application Note 1.3.3 IAR Download The generated images can be downloaded in two ways: IAR J-Link or RLX Probe SWD (introduced in the next section) Ameba-D ImageTool, refer to Image Tool User Guide for more information. Ameba-D demo board supports using J-Link and RLX Probe SWD to download and debug. Image of each project can be download individually. Note: Considering KM4 is powered-on by KM0, you should make sure that KM0 has boot up already before downloading images to KM4.
Ameba-D Application Note Fig 1-12 Switching to the target project view Fig 1-13 J-Link debugger setup Application Note All information provided in this document is subject to legal disclaimers. 10 © REALTEK 2020. All rights reserved.
Ameba-D Application Note Fig 1-14 J-Link interface setup (3) If using RLX Probe, check whether the RLX Probe setting is correct. a) Click Project > Options > Debugger > Setup > Driver, choose “GDB Server” and don not choose “Run to”, as Fig 1-15 shows. b) Click GDB Server > GDB Server, and put correct value in “TCP/IP address or hostname”, as Fig 1-16 shows. The value should be: localhost, port number. KM4: The default port numbers is 3333, which is set in project\realtek_amebaD_va0_example\EWARMRELEASE\
Ameba-D Application Note Fig 1-16 RLX Probe interface setup Fig 1-17 RLX Probe window (4) Click Project > Download > Download active application, image downloading starts. When downloading, Ameba-D prints the log, as Fig 1-18 shows. You can check the log to see if download is successful. Application Note All information provided in this document is subject to legal disclaimers. 12 © REALTEK 2020. All rights reserved.
Ameba-D Application Note Fig 1-18 Downloading log (5) You can also erase all parts of the Flash memory if necessary. Fig 1-19 Erasing Flash memory 1.3.4 IAR Debug You can debug or trace KM0 and KM4 system individually with J-Link or RLX Probe SWD. Note: Considering KM4 is power-on by KM0, you should make sure that KM0 has already boot up before debug KM4. For KM0, there is no such requirement because KM0 is power-on immediately after reset.
Ameba-D Application Note 1.3.4.1 J-Link Debug Follow the steps to debug and trace code of target project with IAR by J-Link: (1) Set the target project as active project and verify the debugger configurations as step (1) and (2). (2) Click Project > Download and Debug or Project > Debug without Downloading. Download and Debug: downloads the application and debug the project object file. If necessary, a make will be performed before download to ensure the project is up to date.
Ameba-D Application Note Fig 1-21 Toggle breakpoint (5) You can trace code step by step with “Step Into” or “Go” until triggering a breakpoint. These function buttons are available on toolbar. 1.3.4.2 RLX Probe Debug Follow the steps to debug and trace code of target project with IAR by RLX Probe: (1) Set the target project as active project and verify the debugger configurations as step (1) and step (3). (2) Click Project > Attach to Running Target. (3) Set the target address.
Ameba-D Application Note Fig 1-23 Running to the target address when debug (4) (5) Toggles a breakpoint at the statement or instruction that contains or is located near the cursor in the source window. The “Toggle Breakpoint” button is on the debug toolbar, as Fig 1-21 shows. You can trace code step by step with “Step Into”, or “Go” until triggering a breakpoint. These function buttons are available on toolbar. 1.3.4.
Ameba-D Application Note Fig 1-24 IAR debug or download error To avoid this error, you should build manually before debug or download, and disable auto-build from Tools > Options > Project > Make before debugging, as Fig 1-25 shows. Application Note All information provided in this document is subject to legal disclaimers. 17 © REALTEK 2020. All rights reserved.
Ameba-D Application Note Fig 1-25 IDE options 1.3.5 IAR Memory Configuration 1.3.5.1 Configuring Memory from IAR IDE In order to allow users to manage memory flexibly, there are some configurations to put some code into certain memory region. In IAR workspace, there are “@PSRAM” and “@SRAM” group. The code in “@PSRAM” group would be linked and loaded into PSRAM, and the code in “@SRAM” group would be linked and loaded into SRAM. The rest of code will be placed on Flash and execute in place.
Ameba-D Application Note Fig 1-26 Memory location configuration 1.3.5.2 Configuring Memory from ICF File IAR uses ICF (IAR Configuration File) to configure memory allocation, so users can configure memory allocation by ICF file. ICF file of Ameba-D location: “project\realtek_amebaD_va0_example\EWARM-RELEASE\ rtl8721dhp_image2_is.icf” for ignore secure project “project\realtek_amebaD_va0_example\EWARM-RELEASE\ rtl8721dhp_image2_tz.
Ameba-D Application Note Fig 1-27 Building sample code 1.5 Used Memory Size Calculation This section explains how to calculate used memory size by users in IAR project, whose version is IAR 8.30.1 or higher. You can refer to “km4_application.map” to observe them after project build. This file can be found in the following folders: Project folder: project\realtek_amebaD_va0_example\EWARM-RELEASE\Debug\List\km4_application IAR GUI’s folder: Output 1.5.
Ameba-D Application Note A4 (SRAM): This section is read-write data in SRAM. P1 (SRAM): This is BSS section in SRAM. 1.5.2 Memory Size 1.5.2.1 Memory Size in SRAM There are two sections resident in SRAM, which are A4 and P1. As we can see from the map file, for standard SDK, these two sections use almost all of the memory space from SRAM (476KB). A4 has size 0x17ad7. P1 has size 0x5dfc8. So totally 0x17ad7 + 0x5dfc8 = 470K bytes memory in SRAM is used.
Ameba-D Application Note So totally 0x8afe8 = 555K bytes memory in XIP is used. 1.5.2.4 Available Heap Size When calculating total used memory size, available heap size after WLAN association and BT connection needs to be considered. In the above case, it is 56096 bytes. Finally, you can use total SRAM 476K bytes to subtract these sections of memory to obtain totally free global memory and free heap in SRAM.
Ameba-D Application Note cause harmful interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one of the following measures: - Reorient or relocate the receiving antenna. Increase the separation between the equipment and receiver. Connect the equipment into an outlet on a circuit different from that to which the receiver is connected.
Ameba-D Application Note Le présent appareil est conforme aux CNR d'Industrie Canada applicables aux appareils radio exempts de licence. L'exploitation est autorisée aux deux conditions suivantes: (1) l'appareil ne doit pas produire de brouillage, et (2) l'utilisateur de l'appareil doit accepter tout brouillage radioélectrique subi, même si le brouillage est susceptible d'en compromettre le fonctionnement.
Ameba-D Application Note localisation avec un autre émetteur), l'autorisation du Canada n'est plus considéré comme valide et l'ID IC ne peut pas être utilisé sur le produit final. Dans ces circonstances, l'intégrateur OEM sera chargé de réévaluer le produit final (y compris l'émetteur) et l'obtention d'une autorisation distincte au Canada.