TI OSAL资料 整理

1 下载地址

http://www.ti.com.cn/tool/cn/z-stack
Z-Stack 3.0.x is TI’s Zigbee 3.0 compliant protocol suite for the CC2530, CC2531, and CC2538 Wireless MCU.
IAR Workbench:

Z-Stack is developed and tested using compilers from IAR. IAR versions used in Z-Stack are available to TI customers for 30 days evaluation at the following link: http://www.iar.com/Products/Wireless-solutions/Tools-for-TI-wireless/.

Application, library, and hex files were built/tested with the following versions of IAR tools. We recommend using the same IAR tool version

EWARM 8.11.1 (8.11.1.13272) for CC2538 Wireless MCU
EW8051 10.10.1 (10.10.1) for CC2530 and CC2531 Wireless MCU
Please contact your local IAR office for further details on license purchasing.

Z-STACK-3.0.1

C:\Texas Instruments\Z-Stack 3.0.1\Components\osal\common
在这里插入图片描述

2 BLE-CC254x-1.4.2.2

下载地址:
http://www.ti.com.cn/tool/cn/ble-stack

C:\Texas Instruments\BLE-CC254x-1.4.2.2\Components\osal\common
在这里插入图片描述

IAR (10.10.1) 安装与破解教程
https://blog.csdn.net/P_xiaojia/article/details/79119058

IAR Embedded Workbench for 8051 10.10下载链接与ZStack-cc2530-2.5.1a下载链接
https://blog.csdn.net/liangtao_1996/article/details/79253191

3 比较好的串口解析例程

C:\Texas Instruments\Z-Stack 3.0.1\Projects\zstack\Utilities\BootLoad\CC2538_UART

/**************************************************************************************************
  Filename:       sb_uart.c
  Revised:        $Date: 2013-06-27 15:44:38 -0700 (Thu, 27 Jun 2013) $
  Revision:       $Revision: 34663 $

  Description:    This file contains the implementation of a special SBL UART driver.


  Copyright 2012-2013 Texas Instruments Incorporated. All rights reserved.

  IMPORTANT: Your use of this Software is limited to those specific rights
  granted under the terms of a software license agreement between the user
  who downloaded the software, his/her employer (which must be your employer)
  and Texas Instruments Incorporated (the "License").  You may not use this
  Software unless you agree to abide by the terms of the License. The License
  limits your use, and you acknowledge, that the Software may not be modified,
  copied or distributed unless embedded on a Texas Instruments microcontroller
  or used solely and exclusively in conjunction with a Texas Instruments radio
  frequency transceiver, which is integrated into your product.  Other than for
  the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  works of, modify, distribute, perform, display or sell this Software and/or
  its documentation for any purpose.

  YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  PROVIDED 揂S IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

  Should you have any questions regarding your right to use this Software,
  contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/

/* ------------------------------------------------------------------------------------------------
 *                                          Includes
 * ------------------------------------------------------------------------------------------------
 */

#include "hal_board.h"
#include "hal_types.h"
#include "sb_exec.h"
#include "sb_main.h"
#include "hw_ioc.h"

/* ------------------------------------------------------------------------------------------------
 *                                           Constants
 * ------------------------------------------------------------------------------------------------
 */

#define HAL_UART_PORT                      UART0_BASE

#define HAL_UART_SYS_CTRL                  SYS_CTRL_PERIPH_UART0
#define HAL_UART_GPIO_BASE                 GPIO_A_BASE
#define HAL_UART_GPIO_PINS                (GPIO_PIN_0 | GPIO_PIN_1)
#define HAL_UART_INT_CTRL                  INT_UART0

#define HalUartISR                         interrupt_uart0

/* ------------------------------------------------------------------------------------------------
 *                                           Local Variables
 * ------------------------------------------------------------------------------------------------
 */

static uint8 txBuf[SB_BUF_SIZE];
static uint32 txHead, txTail;

/* ------------------------------------------------------------------------------------------------
 *                                           Local Functions
 * ------------------------------------------------------------------------------------------------
 */

static void procTx(void);

/*************************************************************************************************
 * @fn      sbUartInit()
 *
 * @brief   Initialize the UART.
 *
 * @param   none
 *
 * @return  none
 */
void sbUartInit(void)
{
  //
  // Set IO clock to the same as system clock
  //
  SysCtrlIOClockSet(SYS_CTRL_SYSDIV_32MHZ);
   
  //
  // Enable UART peripheral module
  //
  SysCtrlPeripheralEnable(SYS_CTRL_PERIPH_UART0);

  //
  // Disable UART function
  //
  UARTDisable(UART0_BASE);

  //
  // Disable all UART module interrupts
  //
  UARTIntDisable(UART0_BASE, 0x1FFF);

  //
  // Set IO clock as UART clock source
  //
  UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

  //
  // Map UART signals to the correct GPIO pins and configure them as
  // hardware controlled.
  //
  IOCPinConfigPeriphOutput(GPIO_A_BASE, GPIO_PIN_1, IOC_MUX_OUT_SEL_UART0_TXD);
  GPIOPinTypeUARTOutput(GPIO_A_BASE, GPIO_PIN_1); 
  IOCPinConfigPeriphInput(GPIO_A_BASE, GPIO_PIN_0, IOC_UARTRXD_UART0);
  GPIOPinTypeUARTInput(GPIO_A_BASE, GPIO_PIN_0);
     
  //
  // Configure the UART for 115,200, 8-N-1 operation.
  // This function uses SysCtrlClockGet() to get the system clock
  // frequency.  This could be also be a variable or hard coded value
  // instead of a function call.
  //
  UARTConfigSetExpClk(UART0_BASE, SysCtrlClockGet(), 115200,
                     (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
  UARTEnable(UART0_BASE);
}

/*************************************************************************************************
 * @fn      sbUartPoll
 *
 * @brief   This routine simulate polling and has to be called by the main loop.
 *
 * @param   void
 *
 * @return  void
 */
void sbUartPoll(void)
{
  procTx();
}

/*************************************************************************************************
 * @fn      sbUartWrite()
 *
 * @brief   Write a buffer to the UART.
 *
 * @param   pBuf - pointer to the buffer that will be written.
 *          len  - length of buffer to write.
 *
 * @return  length of the buffer that was sent.
 */
uint32 sbUartWrite(uint8 *pBuf, uint32 len)
{
  uint32 idx = txHead;
  uint32 cnt = txTail;

  if (cnt == idx)
  {
    cnt = SB_BUF_SIZE;
  }
  else if (cnt > idx)
  {
    cnt = SB_BUF_SIZE - cnt + idx;
  }
  else // (cnt < idx)
  {
    cnt = idx - cnt;
  }

  // Accept "all-or-none" on write request.
  if (cnt < len)
  {
    return 0;
  }

  idx = txTail;

  for (cnt = 0; cnt < len; cnt++)
  {
    txBuf[idx++] = pBuf[cnt];

    if (idx >= SB_BUF_SIZE)
    {
      // txBuf is a circular buffer. When reaching the end - go back to the start.
      idx = 0;
    }
  }

  txTail = idx;
  procTx();

  return len;  // Return the number of bytes actually put into the buffer.
}


bool sbUartCharAvail(void)
{
  return UARTCharsAvail(HAL_UART_PORT);
}


/*************************************************************************************************
 * @fn      sbUartGetChar
 *
 * @brief   Attempt to get an Rx byte.
 *
 * @param   pCh - Pointer to the character buffer into which to read an Rx byte.
 *
 * @return  Zero or One.
 */
uint32 sbUartGetChar(uint8 *pCh)
{
  if (UARTCharsAvail(HAL_UART_PORT))
  {
    *pCh = UARTCharGetNonBlocking(HAL_UART_PORT);
    return 1;
  }

  return 0;
}

/*************************************************************************************************
 * @fn      procTx
 *
 * @brief   Process Tx bytes.
 *
 * @param   void
 *
 * @return  void
 */
static void procTx(void)
{
  while ((txHead != txTail) && (UARTCharPutNonBlocking(HAL_UART_PORT, txBuf[txHead])))
  {
    if (++txHead >= SB_BUF_SIZE)
    {
      txHead = 0;
    }
  }
}

/**************************************************************************************************
*/

4 无锡谷雨电子 BLE CC2540 有一个 OSAL 的教程

在这里插入图片描述

在这里插入图片描述

(稍后补充)

### 回答1: TI OSALTI开放式应用层)在嵌入式系统中是一种开放源代码的操作系统抽象层,可以方便地移植到其他单片机上。 要将TI OSAL移植到其他单片机,首先需要了解目标单片机的硬件架构和特性,以便在移植过程中进行适配和调整。接下来,按照以下步骤进行移植: 1. 了解目标单片机的操作系统支持情况:查看目标单片机的技术文档,了解它是否具有操作系统支持,并确定需要的操作系统功能和资源。 2. 分析TI OSAL的源代码:详细了解TI OSAL的源代码结构、文件组织和功能,特别是与硬件相关的部分。 3. 修改硬件相关的代码:根据目标单片机的硬件架构和特性,修改TI OSAL的硬件相关代码,以适应目标单片机的特定要求。这可能包括中断控制、时钟管理、IO端口配置等。 4. 进行BSP(板级支持包)的移植:根据目标单片机的硬件实现,创建或修改TI OSAL的BSP层代码,以便正确初始化和配置硬件资源,如时钟、GPIO等。 5. 移植底层驱动程序:根据目标单片机的驱动程序接口,修改或重新编写TI OSAL的底层驱动程序,使其能够与目标单片机的硬件进行交互。 6. 测试和调试:在移植完成后,进行测试和调试,确保TI OSAL在目标单片机上能够正常运行,并与硬件和其他软件组件正确交互。 总之,将TI OSAL移植到其他单片机需要深入了解目标单片机的硬件架构和特性,对TI OSAL的源代码进行修改和调整,以适应目标单片机的需求。只有完成适配和调试后,TI OSAL才能在其他单片机上实现正常的运行和功能。 ### 回答2: Ti osal是融合了各种RTOS和软件组件的嵌入式操作系统,它为嵌入式系统的开发提供了一个强大而灵活的平台。要将Ti osal移植到其他单片机,我们需要采取以下步骤: 首先,我们需要了解目标单片机的硬件架构和功能特性。这包括处理器类型、内存结构、外设接口等。只有全面了解目标单片机的硬件特性,才能确保Ti osal能够正确地运行和适配机器环境。 其次,我们需要对Ti osal进行移植,此过程包括移植操作系统的内核、中断处理程序、任务调度器等关键组件。这要求我们对Ti osal的代码结构和功能模块有深入的理解,需要适配目标单片机的硬件架构和特性,并确保所有功能正常运行。 移植过程还包括对Ti osal的外设驱动的移植。这些外设驱动包括串口驱动、定时器驱动、中断控制器等,它们必须与目标单片机的硬件外设相匹配。我们需要根据目标单片机的外设手册和Ti osal的文档,对驱动进行修改和适配。 最后,移植完成后,我们需要进行测试和调试。这包括检查各个功能模块是否正常工作,验证操作系统的稳定性和可靠性,以及确保应用程序能够在新的单片机上正常运行。 综上所述,将Ti osal移植到其他单片机需要深入了解目标单片机的硬件特性,并对Ti osal的内核和驱动进行适配和修改。这是一个复杂的过程,需要不断的测试和调试,以确保移植的成功和稳定性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值