TI BLE5-Stack API Documentation  1.01.01.00
oad_image_header.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  @file oad_image_header.h
4 
5  @brief This file contains the image header definition and structures.
6 
7  Group: WCS, BTS
8  $Target Device: DEVICES $
9 
10  ******************************************************************************
11  $License: BSD3 2017 $
12  ******************************************************************************
13  $Release Name: PACKAGE NAME $
14  $Release Date: PACKAGE RELEASE DATE $
15  ******************************************************************************/
16 
92 #ifndef OAD_IMAGE_HEADER_H
93 #define OAD_IMAGE_HEADER_H
94 
95 #ifdef __cplusplus
96 extern "C"
97 {
98 #endif
99 
100 /*******************************************************************************
101  * INCLUDES
102  ******************************************************************************/
103 #include <stddef.h>
104 #include <stdint.h>
105 
106 /*******************************************************************************
107  * CONSTANTS
108  ******************************************************************************/
109 
110 
111 #ifdef OAD_ONCHIP
112 
127  #define BIM_VAR_ADDR 0x20000400
128 
134  extern uint32_t _bim_var;
135 #endif // OAD_ONCHIP
136 
148 #define OAD_IMG_TYPE_PERSISTENT_APP 0
149 
155 #define OAD_IMG_TYPE_APP 1
156 
162 #define OAD_IMG_TYPE_STACK 2
163 
170 #define OAD_IMG_TYPE_APP_STACK 3
171 
178 #define OAD_IMG_TYPE_NP 4
179 
186 #define OAD_IMG_TYPE_FACTORY 5
187 
194 #define OAD_IMG_TYPE_BIM 6
195 
204 #define OAD_IMG_TYPE_APPSTACKLIB 7
205 
212 #define OAD_IMG_TYPE_USR_BEGIN 16
213 
220 #define OAD_IMG_TYPE_USR_END 31
221 
227 #define OAD_IMG_TYPE_HOST_BEGIN 32
228 
234 #define OAD_IMG_TYPE_HOST_END 63
235 
241 #define OAD_IMG_TYPE_RSVD_BEGIN 64
242 
248 #define OAD_IMG_TYPE_RSVD_END 255
249 
260 #define OAD_WIRELESS_TECH_BLE 0xFFFE
261 
265 #define OAD_WIRELESS_TECH_TIMAC_SUBG 0xFFFD
266 
270 #define OAD_WIRELESS_TECH_TIMAC_2_4G 0xFFFB
271 
275 #define OAD_WIRELESS_TECH_ZIGBEE 0xFFF7
276 
280 #define OAD_WIRELESS_TECH_RF4CE 0xFFEF
281 
285 #define OAD_WIRELESS_TECH_THREAD 0xFFDF
286 
290 #define OAD_WIRELESS_TECH_EASYLINK 0xFFBF
291 
294 #ifdef DeviceFamily_CC26X2
295  #define OAD_IMG_ID_VAL {'C', 'C', '2', '6', 'x', '2', 'R', '1'}
296 #elif defined (DeviceFamily_CC13X2)
297  #define OAD_IMG_ID_VAL {'C', 'C', '1', '3', 'x', '2', 'R', '1'}
298 #elif defined (DeviceFamily_CC26X0R2)
299  #define OAD_IMG_ID_VAL {'O', 'A', 'D', ' ', 'I', 'M', 'G', ' '}
300 #elif defined (DOXYGEN)
301 
311  #define OAD_IMG_ID_VAL
312 #else
313  #error "Unknown Device Family"
314 #endif //DeviceFamily_CC26X2
315 
324 #define OAD_EXTFL_ID_VAL {'O', 'A', 'D', ' ', 'N', 'V', 'M', '1'}
325 
326 
335 #define CRC_OFFSET offsetof(imgHdr_t, fixedHdr.crc32)
336 
340 #define BIM_VER_OFFSET offsetof(imgHdr_t, fixedHdr.bimVer)
341 
346 #define IMG_DATA_OFFSET BIM_VER_OFFSET
347 
351 #define IMG_INFO_OFFSET offsetof(imgHdr_t, fixedHdr.imgCpStat)
352 
356 #define IMG_COPY_STAT_OFFSET IMG_INFO_OFFSET
357 
361 #define CRC_STAT_OFFSET offsetof(imgHdr_t, fixedHdr.crcStat)
362 
366 #define IMG_TYPE_OFFSET offsetof(imgHdr_t, fixedHdr.imgType)
367 
371 #define BOUNDARY_SEG_OFFSET offsetof(imgHdr_t, fixedHdr.segTypeBd)
372 
373 
377 #define SEG_LEN_OFFSET 4
378 
389 #define SEG_HDR_LEN 12
390 
395 #define OAD_IMG_ID_LEN 8
396 
400 #define OAD_SW_VER_LEN 4
401 
405 #define OAD_IMG_HDR_LEN sizeof(imgFixedHdr_t)
406 
418 #define IMG_BOUNDARY_SEG_ID 0x00
419 
423 #define IMG_PAYLOAD_SEG_ID 0x01
424 
425 
429 #define IMG_NONCOUNT_SEG_ID 0x02
430 
434 #define IMG_SECURITY_SEG_ID 0x03
435 
443 #define BIM_VER 0x3
444 
450 #define META_VER 0x1
451 
455 #define DEFAULT_STATE 0xFF
456 
461 #define CRC_VALID 0xFE
462 
467 #define CRC_INVALID 0xFC
468 
472 #define NEED_COPY 0xFE
473 
477 #define COPY_DONE 0xFC
478 
482 #define EFL_MATADATA_HDR_LEN OAD_IMG_HDR_LEN + 8
483 
487 #define INVALID_ADDR 0xFFFFFFFF
488 
492 #define INVALID_LEN INVALID_ADDR
493 
497 #define DEFAULT_CRC 0xFFFFFFFF
498 
499 /*******************************************************************************
500  * Typedefs
501  */
502 
504 #if defined (__IAR_SYSTEMS_ICC__)
505  #define TYPEDEF_STRUCT_PACKED __packed typedef struct
506 #elif defined __TI_COMPILER_VERSION || defined __TI_COMPILER_VERSION__
507  #define TYPEDEF_STRUCT_PACKED typedef struct __attribute__((packed))
508 #elif defined (__GNUC__)
509  #define TYPEDEF_STRUCT_PACKED typedef struct __attribute__((__packed__))
510 #endif
511 
517 TYPEDEF_STRUCT_PACKED
518 {
519  uint8_t imgID[8];
520  uint32_t crc32;
521  uint8_t bimVer;
522  uint8_t metaVer;
523  uint16_t techType;
524  uint8_t imgCpStat;
525  uint8_t crcStat;
526  uint8_t imgType;
527  uint8_t imgNo;
528  uint32_t imgVld;
529  uint32_t len;
530  uint32_t prgEntry;
531  uint8_t softVer[4];
532  uint32_t imgEndAddr;
533  uint16_t hdrLen;
534  uint16_t rfu;
536 
543 TYPEDEF_STRUCT_PACKED
544 {
545  uint8_t segTypeImg;
546  uint16_t wirelessTech;
547  uint8_t rfu;
548  uint32_t imgSegLen;
549  uint32_t startAddr;
551 
561 TYPEDEF_STRUCT_PACKED
562 {
563  uint8_t segTypeBd;
564  uint16_t wirelessTech;
565  uint8_t rfu;
566  uint32_t boundarySegLen;
567  uint32_t stackStartAddr;
568  uint32_t stackEntryAddr;
569  uint32_t ram0StartAddr;
570  uint32_t ram0EndAddr;
572 
581 TYPEDEF_STRUCT_PACKED
582 {
584 #if (!defined(STACK_LIBRARY) && (defined(SPLIT_APP_STACK_IMAGE)))
585  boundarySeg_t boundarySeg;
586 #endif
588 } imgHdr_t;
589 
592 #ifdef __cplusplus
593 }
594 #endif
595 
596 #endif /* OAD_IMAGE_HEADER_H */
uint16_t hdrLen
Total length of the image header.
Definition: oad_image_header.h:533
uint32_t imgVld
This field is RFU.
Definition: oad_image_header.h:528
uint16_t techType
Wireless protocol type BLE/TI-MAC/ZIGBEE etc.
Definition: oad_image_header.h:523
uint32_t ram0StartAddr
RAM entry start address.
Definition: oad_image_header.h:569
uint32_t startAddr
Start address of image on internal flash.
Definition: oad_image_header.h:549
uint32_t prgEntry
Program entry address.
Definition: oad_image_header.h:530
uint16_t wirelessTech
Wireless technology type.
Definition: oad_image_header.h:546
uint32_t crc32
Image&#39;s 32-bit CRC value.
Definition: oad_image_header.h:520
uint32_t ram0EndAddr
RAM entry end address.
Definition: oad_image_header.h:570
uint16_t rfu
Reserved bytes.
Definition: oad_image_header.h:534
uint8_t metaVer
Metadata version.
Definition: oad_image_header.h:522
uint8_t imgNo
Image number of &#39;image type&#39;.
Definition: oad_image_header.h:527
uint16_t wirelessTech
Wireless technology type.
Definition: oad_image_header.h:564
uint8_t segTypeBd
Segment type - for boundary segment.
Definition: oad_image_header.h:563
uint32_t len
Image length in bytes.
Definition: oad_image_header.h:529
uint32_t boundarySegLen
Boundary segment length.
Definition: oad_image_header.h:566
uint8_t bimVer
BIM version.
Definition: oad_image_header.h:521
uint32_t stackStartAddr
Start address of stack image on internal flash.
Definition: oad_image_header.h:567
uint8_t crcStat
CRC status.
Definition: oad_image_header.h:525
uint8_t segTypeImg
Segment type - for Contiguous image payload.
Definition: oad_image_header.h:545
uint32_t stackEntryAddr
Stack start address.
Definition: oad_image_header.h:568
uint8_t imgType
Image Type.
Definition: oad_image_header.h:526
Definition: oad_image_header.h:561
imgPayloadSeg_t imgPayload
Required contiguous image segment.
Definition: oad_image_header.h:587
imgFixedHdr_t fixedHdr
Required core image header.
Definition: oad_image_header.h:583
uint32_t imgSegLen
Payload segment length.
Definition: oad_image_header.h:548
uint8_t imgCpStat
Image copy status.
Definition: oad_image_header.h:524
Definition: oad_image_header.h:581
Definition: oad_image_header.h:517
uint32_t imgEndAddr
Address of the last byte of a contiguous image.
Definition: oad_image_header.h:532
uint8_t rfu
Reserved byte.
Definition: oad_image_header.h:565
uint8_t rfu
Reserved byte.
Definition: oad_image_header.h:547
Definition: oad_image_header.h:543
Copyright 2018, Texas Instruments Incorporated