这里会显示出您选择的修订版和当前版本之间的差别。
cc2640r2f:cc2640_to_cc2640r2f [2019/08/29 20:02] jaylee ↷ 页面cc2640r2f:migration_guides:cc2640_to_cc2640r2f:cc2640_to_cc2640r2f被移动至cc2640r2f:cc2640_to_cc2640r2f:cc2640_to_cc2640r2f |
cc2640r2f:cc2640_to_cc2640r2f [2021/06/22 23:14] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | < | ||
- | |||
- | # CC2640 to CC2640R2F # | ||
- | |||
- | |||
- | ## Introduction ## | ||
- | |||
- | |||
- | This section describes main differences an Application Developer must | ||
- | be aware of between the CC2640 and the CC2640R2F along with a example | ||
- | porting guide to demonstrate the migration effort. | ||
- | |||
- | The CC2640R2F was designed to increase flash availability for the | ||
- | application, | ||
- | |||
- | Due to the underlaying hardware and platform based on the CC2640, the | ||
- | migration effort from a CC2640 to CC2640R2F is very minor. | ||
- | For more information on specific steps, | ||
- | see : | ||
- | for specific instructions. | ||
- | |||
- | ## Features and Benefits ## | ||
- | |||
- | |||
- | To enable maximum possible flash availability, | ||
- | * : | ||
- | * : | ||
- | |||
- | Additional benefits of the CC2640R2F: | ||
- | * : | ||
- | * : | ||
- | * : | ||
- | * : | ||
- | * : | ||
- | |||
- | These features and benefits enable rapid development, | ||
- | innovative robust products. | ||
- | |||
- | .. _cc2640-to-cc2640r2-additional-rom-support: | ||
- | |||
- | Additional ROM Support on CC2640R2F | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | A majority of the increase in application flash availability is due to | ||
- | portions of the |OLDSTACK| being placed into ROM. When | ||
- | enabled, the stack flash usage dramatically decreases. Up to an ~50% | ||
- | decrease of |OLDSTACK| flash usage can be realized with this feature alone; | ||
- | this results in up to an additional 30kB for the application when | ||
- | migrating from an existing CC2640 project. | ||
- | |||
- | In addition, the |OLDSTACK| has the following |CORESPEC| | ||
- | features always enabled: | ||
- | |||
- | * Ping | ||
- | * Slave feature exchange | ||
- | * Connection Parameter Update Request | ||
- | * Multirole Connections | ||
- | * Privacy | ||
- | * LE Data Length Extension | ||
- | |||
- | See : | ||
- | selecting features. | ||
- | |||
- | See : | ||
- | |||
- | .. warning:: | ||
- | Flashing a CC2640 with binaries made for CC2640R2F will | ||
- | result in a spin-lock prior to ``main``. | ||
- | |||
- | .. figure:: resources/ | ||
- | :align: center | ||
- | |||
- | A screen shot highlighting the spin-lock in IAR when running | ||
- | CC2640R2F code on a CC2640. | ||
- | |||
- | .. figure:: resources/ | ||
- | :align: center | ||
- | |||
- | A screen shot highlighting the spin-lock in CCS when running | ||
- | CC2640R2F code on a CC2640. | ||
- | |||
- | .. _cc2640-to-cc2640r2-improved-icall: | ||
- | |||
- | Improved ICall and App/Stack library builds | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | ICall has been optimized for reduced flash usage and increased stack | ||
- | operational efficiency. Given these improvements to ICall, stack library | ||
- | builds are possible. | ||
- | |||
- | Library builds will not have an application/ | ||
- | linking is enabled instead. This allows the linker to only link the | ||
- | stack components that are utilized. Global linking also allows objects | ||
- | used by both the application and stack to be shared. | ||
- | |||
- | No ICall/Stack API changes are required to realize these benefits. | ||
- | |||
- | For details regarding improved ICall and it's benefits, see : | ||
- | |||
- | For additional information on ICall see : | ||
- | |||
- | .. _cc2640-to-cc2640r2-word-alignment-ccs: | ||
- | |||
- | Word alignment boundary support in CCS for split image build configurations | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | In previous versions of Code Composer Studio, the flash-loader driver | ||
- | was limited to writing/ | ||
- | that in the dual-image configuration of the CC2640 on CCS, the boundary | ||
- | was forced to be page aligned. Worst case, up to a page (4kB) of flash | ||
- | could potentially wasted to maintain this boundary. | ||
- | |||
- | Utilizing the upgraded word aligned CCS flash-loader driver in CCS 7.0.0, along | ||
- | with enhancements in the Frontier tool, limits the worst case to the size of | ||
- | a word (32 bits). Word alignment allows for additional Application or Stack | ||
- | Flash usage. | ||
- | |||
- | .. note:: | ||
- | IAR Embedded Workbench for ARM supported this feature with CC2640. | ||
- | |||
- | .. note:: | ||
- | OAD currently only supports page aligned boundaries to allow for | ||
- | application or stack updates. For word alignment with OAD, please | ||
- | see : | ||
- | |||
- | .. _cc2640-to-cc2640r2-launchpad-support: | ||
- | |||
- | CC2640R2F LaunchPad Support | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | All example applications are compatible with the CC2640R2F LaunchPad development | ||
- | kit. These features allow for a unified development experience and empowers | ||
- | developers to rapidly release to market. | ||
- | |||
- | `CC2640R2 LaunchPad Development Kit Product Page < | ||
- | |||
- | .. _cc2640-to-cc2640r2-improved-oad-support: | ||
- | |||
- | Improved OAD Support | ||
- | ^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | OAD Support on the CC2640R2F has been improved with new features to | ||
- | boost flash availability to both the application and the stack and | ||
- | reduce costs to future proof. | ||
- | |||
- | The CC2640R2F has been improved to allow the linkages to TI-RTOS ROM | ||
- | functions for OAD application images. The nature of OAD and BIM on | ||
- | CC2640 forced TI-RTOS to be linked into flash for OAD application | ||
- | images. | ||
- | |||
- | In addition, BIM for CC2640R2F is redesigned to reside in Page 31 of | ||
- | flash. CC2640' | ||
- | Application and Stack flash. This feature allows for an additional Page | ||
- | for the developer to use. | ||
- | |||
- | BTool now supports the OAD profile, replacing BLE Device Monitor. This | ||
- | change allows us to give a consistent OAD Downloader experience across | ||
- | all devices supporting TI |OLDSTACK|. | ||
- | |||
- | |||
- | For more information regarding OAD, see : | ||
- | |||
- | .. note:: | ||
- | On-Chip OAD was supported by IAR Embedded Workbench for ARM for | ||
- | CC2640. | ||
- | |||
- | .. _cc2640-to-cc2640r2-ti-u-stack-for-broadcaster: | ||
- | |||
- | Micro BLE Stack for broadcaster applications | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | The Micro BLE Stack is included with the |OLDSTACK|. It features the | ||
- | ability to send non-connectable advertisements, | ||
- | scannable advertisements and scanning in the future. | ||
- | |||
- | For more information on the Micro BLE Stack see : | ||
- | |||
- | .. _cc2640-to-cc2640r2-additional-vs-hci-cmds: | ||
- | |||
- | Additional Vendor Specific HCI Functionality | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | Two additional vendor specific commands were created in |OLDSTACK|: | ||
- | |||
- | * : | ||
- | |||
- | Scan Request Detection allows for a BLE Application operating as a | ||
- | Peripheral or Broadcaster GAPRole to receive a notification when a Scan | ||
- | Request is received from a peer device. | ||
- | |||
- | * : | ||
- | |||
- | Scan Event Notifications allows for a BLE Application operating as a | ||
- | Central or Observer GAPRole to receive a notification when a Scan Event | ||
- | is completed. | ||
- | |||
- | .. _cc2640-to-cc2640r2-porting-guide: | ||
- | |||
- | Porting Guide from CC2640 to CC2640R2F | ||
- | -------------------------------------- | ||
- | |||
- | These sections describe porting between different versions of the BLE-Stack. | ||
- | from versions of the BLE-Stack prior to BLE-Stack 2.2.1, see the | ||
- | `Porting Guide Wiki < | ||
- | |||
- | Porting Instructions from BLE-Stack 2.2.1 to BLE-Stack 3.00.00 | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | This section will describe a way to port a project from BLE-Stack 2.2.1 to | ||
- | a BLE-Stack 3.00.00 project. | ||
- | |||
- | For this porting guide, simple\_peripheral from BLE-Stack 2.2.1 will be ported | ||
- | over to BLE-Stack 3.00.00. Due to the a number of changes in the directory | ||
- | structure and drivers, we will utilize the simple\_peripheral project in | ||
- | BLE-Stack 3.00.00 as the project base. In other words, no modifications will be | ||
- | made to the BLE-Stack 2.2.1 project. All application specific code will be | ||
- | inserted into the BLE-Stack 3.00.00 project. | ||
- | |||
- | #. Choose a BLE-Stack 3.00.00 example project | ||
- | |||
- | For reference, see available sample projects that start with simple\_ | ||
- | |||
- | In this example, we're going to use simple\_peripheral as the starting | ||
- | BLE-Stack 3.00.00 sample project. | ||
- | |||
- | .. tip:: | ||
- | |||
- | All BLE-Stack 3.00.00 sample projects by default contain all the | ||
- | necessary includes and preprocessor defines to utilize improved | ||
- | ICall in FlashROM\_Library configurations. | ||
- | |||
- | #. Transfer all modified application files into the example project | ||
- | |||
- | Place modified profile and application files the existing files in | ||
- | the |SDK| to match those in BLE-Stack 2.2.1 project. | ||
- | |||
- | Modify ``main.c`` in the BLE-Stack 3.00.00 example if additional tasks | ||
- | were added in the BLE-Stack 2.2.1 project. | ||
- | |||
- | In this example, the following files from BLE-Stack 2.2.1 were moved into | ||
- | simple\_peripheral BLE-Stack 3.00.00 example: | ||
- | |||
- | - ``simple_peripheral.c`` | ||
- | - ``simple_peripheral.h`` | ||
- | - ``simple_gatt_profile.c`` | ||
- | - ``simple_gatt_profile.h`` | ||
- | |||
- | .. note:: | ||
- | The folder structure has changed, see : | ||
- | |||
- | .. attention:: | ||
- | For applications using **Directed Advertisements** comment | ||
- | out ``#define GBM_GATT_NO_CLIENT`` in ``gapbondmgr.c`` of BLE | ||
- | v3.0.0 project to remain compliant with the |CORESPEC|. | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | #ifdef GATT_NO_CLIENT | ||
- | #ifndef GBM_GATT_NO_CLIENT | ||
- | //#define GBM_GATT_NO_CLIENT // <-- Comment this out | ||
- | #endif // !GBM_GATT_NO_CLIENT | ||
- | #endif // GATT_NO_CLIENT | ||
- | |||
- | See : | ||
- | information. | ||
- | |||
- | #. Include ``icall_api.h`` if Stack/ICall APIs are used. Add the following | ||
- | # | ||
- | APIs. | ||
- | |||
- | In this example, add:: | ||
- | |||
- | #include " | ||
- | |||
- | into the following files **AFTER** all other includes. In for the | ||
- | simple\_peripheral port, add this into these files: | ||
- | |||
- | * ``simple_peripheral.c`` | ||
- | * ``simple_gatt_profile.c`` | ||
- | |||
- | For more information regarding ``icall_api.h`` see | ||
- | : | ||
- | |||
- | .. danger:: | ||
- | All Stack/ICall APIs are listed in ``icall_api.h``. If any APIs are | ||
- | used without ``icall_api.h``, | ||
- | erratic runtime behaviors! | ||
- | |||
- | #. Convert the application to use the TI-RTOS Event module. | ||
- | ICall/Stack now synchronize with threads with the TI-RTOS Event Module | ||
- | instead of the TI-RTOS Semaphore module. | ||
- | |||
- | In this example, simple\_peripheral needs to modified as shown in | ||
- | : | ||
- | |||
- | #. Apply changes from TI-RTOS drivers used in BLE-Stack 2.2.1 to the TI-RTOS | ||
- | | ||
- | |||
- | TI-RTOS Kernel is now packaged with the |SDK|. When | ||
- | migrating from the BLE-Stack 2.2.1, the following drivers have changed. | ||
- | Please see the changes to these files between TI-RTOS for SimpleLink | ||
- | CC13xx/ | ||
- | |||
- | - ``PDMCC26XX.h`` | ||
- | - ``PDMCC26XX_util.h`` | ||
- | - ``PINCC26XX.h`` | ||
- | - ``PWMTimerCC26XX.h`` | ||
- | - ``UARTCC26XX.h`` | ||
- | - ``WatchdogCC26XX.h`` | ||
- | |||
- | Also, refer to the |TIRTOSUPGRADE| | ||
- | for additional information and the TI-RTOS examples included with |SDK|. | ||
- | |||
- | For additional information on how BLE-Stack 3.00.00 uses TI-RTOS see | ||
- | : | ||
- | |||
- | For any utilized TI Drivers, review `TI-RTOS Kernel Users Guide`_ and | ||
- | `Driver APIs < | ||
- | |||
- | In this example, simple\_periphral includes paths need to modified. The | ||
- | TI-RTOS DisplayDriver driver has been relocated to the following location: | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | #include < | ||
- | #include < | ||
- | |||
- | #. Build stack project | ||
- | |||
- | - Select **FlashROM_Library** build configuration for the Stack project in | ||
- | IDE. | ||
- | - Build the Stack project. In the Output Folder of the IDE, a library | ||
- | file will be generated. | ||
- | |||
- | The BLE-Stack 3.00.00 simple\_peripheral example Project has the following | ||
- | configurations related to Library builds. | ||
- | |||
- | .. table:: | ||
- | |||
- | +----------------------------+-----------------------+ | ||
- | | App Build Configs | ||
- | +============================+=======================+ | ||
- | | **FlashROM** | ||
- | +----------------------------+-----------------------+ | ||
- | | **FlashROM\_StackLibrary** | **FlashROM\_Library** | | ||
- | +----------------------------+-----------------------+ | ||
- | |||
- | If a linked stack and application image is desired, a the library project | ||
- | must be built in the **FlashROM\_Library** configuration and the application | ||
- | project must be builts in the **FlashROM\_StackLibrary** configuration. | ||
- | **FlashROM\_Library** only generates a library for the application project | ||
- | to link with. As a result, flashing the stack project is impossible with | ||
- | this build configuration. | ||
- | |||
- | **FlashROM** build configurations implement a boundary that is generated by | ||
- | the frontier boundary tool. | ||
- | |||
- | |||
- | #. Build application project | ||
- | |||
- | - Select **FlashROM_StackLibrary** build configuration for the Application | ||
- | Project in IDE. | ||
- | |||
- | - Build and flash the project onto the CC2640R2F. | ||
- | |||
- | At this point, you should have a functional BLE-Stack 3.00.00 project | ||
- | running on the CC2640R2F. | ||
- | |||
- | .. _cc2640-to-cc2640r2-using-events: | ||
- | |||
- | ICall Utilizes the TI-RTOS Event Module Instead of Semaphores | ||
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- | |||
- | Applications for |OLDSTACK| projects now use the TI-RTOS Event module | ||
- | instead of the TI-RTOS Semaphore module to implement stack-application ICall | ||
- | messaging and synchronization. The following items need to be changed when | ||
- | porting applications from BLE-Stack 2.2.1 to BLE-Stack 3.00.00. Existing | ||
- | applications that utilize Semaphores for non-ICall aware tasks do **not** need | ||
- | to adapt to the Event module. | ||
- | |||
- | For more information on how to use the Event module, see | ||
- | : | ||
- | the `TI-RTOS Kernel Users Guide`_ | ||
- | |||
- | .. tip:: | ||
- | To compare the changes required to use the TI-RTOS Event module instead of | ||
- | its Semaphore module in your application, | ||
- | | ||
- | |||
- | #. Change include paths from Semaphore to Event module and add ``icall_api.h`` | ||
- | into your application. | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | #include < | ||
- | #include < | ||
- | #include " | ||
- | |||
- | #. Change the type ``ICall_Semaphore`` to ``ICall_SyncHandle`` | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | static ICall_Semaphore sem; // | ||
- | static ICall_SyncHandle syncEvent; | ||
- | |||
- | Replace any references to ``sem`` with ``syncEvent``. | ||
- | |||
- | #. Change existing application semaphores to Event types. Previously, semaphores | ||
- | | ||
- | Event IDs. | ||
- | |||
- | **Remove** | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | |||
- | #define SBP_STATE_CHANGE_EVT | ||
- | #define SBP_CHAR_CHANGE_EVT | ||
- | #define SBP_PERIODIC_EVT | ||
- | #define SBP_CONN_EVT_END_EVT | ||
- | |||
- | **Add** | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | // Internal events for RTOS application | ||
- | #define SBP_ICALL_EVT | ||
- | #define SBP_QUEUE_EVT | ||
- | #define SBP_STATE_CHANGE_EVT | ||
- | #define SBP_CHAR_CHANGE_EVT | ||
- | #define SBP_PERIODIC_EVT | ||
- | #define SBP_CONN_EVT_END_EVT | ||
- | |||
- | #define SBP_ALL_EVENTS | ||
- | SBP_QUEUE_EVT | ||
- | SBP_STATE_CHANGE_EVT | | ||
- | SBP_CHAR_CHANGE_EVT | ||
- | SBP_PERIODIC_EVT | ||
- | SBP_CONN_EVT_END_EVT) | ||
- | |||
- | #. Relocate the global ``events`` flag. Remove the global ``uint16_t events`` | ||
- | | ||
- | as a local variable. | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | #if defined(FEATURE_OAD) | ||
- | // Event data from OAD profile. | ||
- | static Queue_Struct oadQ; | ||
- | static Queue_Handle hOadQ; | ||
- | #endif // | ||
- | |||
- | // events flag for internal application events. | ||
- | static uint16_t events; // Remove | ||
- | |||
- | // Task configuration | ||
- | Task_Struct sbpTask; | ||
- | Char sbpTaskStack[SBP_TASK_STACK_SIZE]; | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) | ||
- | { | ||
- | uint32_t events; // Add | ||
- | |||
- | // Initialize application | ||
- | SimpleBLEPeripheral_init(); | ||
- | |||
- | // Application main loop | ||
- | for (;;) | ||
- | { | ||
- | |||
- | // Waits for an event to be posted associated with the calling thread. | ||
- | // Note that an event associated with a thread is posted when a | ||
- | // message is queued to the message receive queue of the thread | ||
- | events = Event_pend(syncEvent, | ||
- | ICALL_TIMEOUT_FOREVER); | ||
- | |||
- | if (events) | ||
- | { | ||
- | ICall_EntityID dest; | ||
- | ICall_ServiceEnum src; | ||
- | |||
- | |||
- | #. Replace ``ICall_wait()`` in Application Task with ``Event_pend()`` | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) | ||
- | { | ||
- | // Initialize application | ||
- | | ||
- | |||
- | // Application main loop | ||
- | for (;;) | ||
- | { | ||
- | // Waits for a signal to the semaphore associated with the calling thread. | ||
- | // Note that the semaphore associated with a thread is signaled when a | ||
- | // message is queued to the message receive queue of the thread or when | ||
- | // ICall_signal() function is called onto the semaphore. | ||
- | | ||
- | |||
- | if (errno == ICALL_ERRNO_SUCCESS) // Remove | ||
- | { | ||
- | ICall_EntityID dest; | ||
- | ICall_ServiceEnum src; | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) | ||
- | { | ||
- | uint32_t events; | ||
- | |||
- | // Initialize application | ||
- | SimpleBLEPeripheral_init(); | ||
- | |||
- | // Application main loop | ||
- | for (;;) | ||
- | { | ||
- | // Waits for an event to be posted associated with the calling thread. | ||
- | // Note that an event associated with a thread is posted when a | ||
- | // message is queued to the message receive queue of the thread | ||
- | events = Event_pend(syncEvent, | ||
- | ICALL_TIMEOUT_FOREVER); | ||
- | |||
- | if (events) // Add | ||
- | { | ||
- | ICall_EntityID dest; | ||
- | ICall_ServiceEnum src; | ||
- | |||
- | #. Replace ``Semaphore_post()`` with ``Event_post()`` and remove any references | ||
- | to the previously used ``events`` flag. | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | static void SimpleBLEPeripheral_clockHandler(UArg arg) | ||
- | { | ||
- | // Store the event. | ||
- | events |= arg; // Remove | ||
- | |||
- | // Wake up the application. | ||
- | Semaphore_post(sem); | ||
- | } | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | if (events & SBP_PERIODIC_EVT) | ||
- | { | ||
- | events &= ~SBP_PERIODIC_EVT; | ||
- | |||
- | Util_startClock(& | ||
- | |||
- | // Perform periodic application task | ||
- | SimpleBLEPeripheral_performPeriodicTask(); | ||
- | } | ||
- | |||
- | .. code-block:: | ||
- | :linenos: | ||
- | : | ||
- | |||
- | static void SimpleBLEPeripheral_clockHandler(UArg arg) | ||
- | { | ||
- | // Wake up the application. | ||
- | Event_post(syncEvent, | ||
- | } | ||
- | |||
- | ## 加入我们 ## | ||
- | 文章所有代码、工具、文档开源。加入我们[**QQ群 591679055**](http:// | ||
- | <div> | ||
- | <p align=" | ||
- | <a target=" | ||
- | © Copyright 2017, 成都乐控畅联科技有限公司. | ||
- | </p> | ||
- | </ | ||
- | </ | ||