二進(jìn)制庫制作與使用

怎樣制作類似CH58xBLE_ROMx.hex 這樣的庫,使自己的應(yīng)用與藍(lán)牙應(yīng)用分開。升級的時候使升級文件更小更方便

/******************************************************************************/
#ifndef?LIB_FLASH_BASE_ADDRESSS
#define?LIB_FLASH_BASE_ADDRESSS???0x00010000
#endif
#define?LIB_FLASH_MAX_SIZE????????0x00030000
#define?LIB_RAM_MAX_SIZE??????????0x00002000

#define?RAM_BASE_ADDRESSS?????????0x20000000
#define?UUID_BASE_ADDRESSS????????(LIB_FLASH_BASE_ADDRESSS+0x08)
#define?FUNCITON_BASE_ADDRESSS????(LIB_FLASH_BASE_ADDRESSS+0x34)

#define??BLE_LIB_UUID(n)?(?UUID_BASE_ADDRESSS+n*2?)
#define??BLE_LIB_RAM_JT(n)?(*(uint32_t*)(?RAM_BASE_ADDRESSS+n*4?))
#define??BLE_LIB_JT(n)?(*(uint32_t*)(?FUNCITON_BASE_ADDRESSS+n*4?))
#define??VER_LIB??((??const?uint8_t*)??????BLE_LIB_JT(0))

/*******************************************************************************
?*?UUID?defined
?*/
/**
?*?GATT?Services
?*/
#define??gapServiceUUID??((const?uint8_t*)?????????BLE_LIB_UUID(0))?
#define??gattServiceUUID??((const?uint8_t*)????????BLE_LIB_UUID(1))

/**
?*?GATT?Attribute?Types
?*/
#define??primaryServiceUUID??((const?uint8_t*)?????BLE_LIB_UUID(2))
#define??secondaryServiceUUID??((const?uint8_t*)???BLE_LIB_UUID(3))
#define??includeUUID??((const?uint8_t*)????????????BLE_LIB_UUID(4))
#define??characterUUID??((const?uint8_t*)??????????BLE_LIB_UUID(5))

/**
?*?GATT?Characteristic?Descriptors
?*/
#define??charExtPropsUUID??((const?uint8_t*)???????BLE_LIB_UUID(6))
#define??charUserDescUUID??((const?uint8_t*)???????BLE_LIB_UUID(7))
#define??clientCharCfgUUID??((const?uint8_t*)??????BLE_LIB_UUID(8))
#define??servCharCfgUUID??((const?uint8_t*)????????BLE_LIB_UUID(9))
#define??charFormatUUID??((const?uint8_t*)?????????BLE_LIB_UUID(10))
#define??charAggFormatUUID??((const?uint8_t*)??????BLE_LIB_UUID(11))
#define??validRangeUUID??((const?uint8_t*)?????????BLE_LIB_UUID(12))
#define??extReportRefUUID??((const?uint8_t*)???????BLE_LIB_UUID(13))
#define??reportRefUUID??((const?uint8_t*)??????????BLE_LIB_UUID(14))

/**
?*?GATT?Characteristic?Types
?*/
#define??deviceNameUUID??((const?uint8_t*)?????????BLE_LIB_UUID(15))
#define??appearanceUUID??((const?uint8_t*)?????????BLE_LIB_UUID(16))
#define??periPrivacyFlagUUID??((const?uint8_t*)????BLE_LIB_UUID(17))
#define??reconnectAddrUUID??((const?uint8_t*)??????BLE_LIB_UUID(18))
#define??periConnParamUUID??((const?uint8_t*)??????BLE_LIB_UUID(19))
#define??serviceChangedUUID??((const?uint8_t*)?????BLE_LIB_UUID(10))
#define??centAddrResUUID??((const?uint8_t*)????????BLE_LIB_UUID(21))

/*******************************************************************************
?*?PUBLIC?FUNCTIONS
?*/
#define????tmos_rand????((??uint32_t??(*)??(?void??))??BLE_LIB_JT(1))?//?pseudo-random?number
#define????tmos_memcmp??((??BOOL?(*)??(?const?void?*src1,?const?void?*src2,?uint32_t?len?))??BLE_LIB_JT(2))??//?TRUE?-?same,?FALSE?-?different
#define????tmos_isbufset?((?BOOL?(*)??(?uint8_t?*buf,?uint8_t?val,?uint32_t?len?))??BLE_LIB_JT(3))?//?TRUE?if?all?"val",FALSE?otherwise
#define????tmos_strlen??((??uint32_t??(*)??(?char?*pString?))??BLE_LIB_JT(4))
#define????tmos_memset??((??void?(*)??(?void?*?pDst,?uint8_t?Value,?uint32_t?len?))??BLE_LIB_JT(5))
#define????tmos_memcpy??((??void?(*)??(?void?*dst,?const?void?*src,?uint32_t?len?))??BLE_LIB_JT(6))

/**
?*?@brief???start?a?event?immediately
?*
?*?@param???taskID?-?task?ID?of?event
?*?@param???event?-?event?value
?*
?*?@return??0?-?SUCCESS.
?*/
#define????tmos_set_event??((??bStatus_t??(*)??(?tmosTaskID?taskID,?tmosEvents?event?))??BLE_LIB_JT(7))

/**
?*?@brief???clear?a?event?already?timeout,?cannot?be?used?in?it?own?event?function.
?*
?*?@param???taskID?-?task?ID?of?event
?*?@param???event?-?event?value
?*
?*?@return??0?-?SUCCESS.
?*/
#define????tmos_clear_event??((??bStatus_t??(*)??(?tmosTaskID?taskID,?tmosEvents?event?))??BLE_LIB_JT(8))

/**
?*?@brief???start?a?event?after?period?of?time
?*
?*?@param???taskID?-?task?ID?to?set?event?for
?*?@param???event?-?event?to?be?notified?with
?*?@param???time?-?timeout?value
?*
?*?@return??TRUE,FALSE.
?*/
#define????tmos_start_task??((??BOOL??(*)??(?tmosTaskID?taskID,?tmosEvents?event,?tmosTimer?time??))??BLE_LIB_JT(9))

/**
?*?@brief???This?function?is?called?to?start?a?timer?to?expire?in?n?system?clock?time.
?*??????????When?the?timer?expires,?the?calling?task?will?get?the?specified?event
?*??????????and?the?timer?will?be?reloaded?with?the?timeout?value.
?*
?*?@param???taskID?-?task?ID?to?set?timer?for
?*?@param???event?-?event?to?be?notified?with
?*?@param???time?-?timeout?value
?*
?*?@return??SUCCESS,?or?NO_TIMER_AVAIL.
?*/
#define		?tmos_start_reload_task	((	bStatus_t	(*)	(?tmosTaskID?taskID,?tmosEvents?event,?tmosTimer?time??))	BLE_LIB_JT(126)?)

/**
?*?@brief???stop?a?event
?*
?*?@param???taskID?-?task?ID?of?event
?*?@param???event?-?event?value
?*
?*?@param???None.
?*
?*?@return??SUCCESS.
?*/
#define????tmos_stop_task??((??bStatus_t??(*)??(?tmosTaskID?taskID,?tmosEvents?event?))??BLE_LIB_JT(10))


你好,可參考:

1694400247777188.png

1694400247120955.png



只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频