2019-08-14 14:34:18 +02:00
|
|
|
|
/****************************************************************************
|
|
|
|
|
* boards/arm/lpc31xx/ea3152/tools/lpchdr.h
|
2011-10-13 19:49:11 +02:00
|
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-10-13 19:49:11 +02:00
|
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-10-13 19:49:11 +02:00
|
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
|
* under the License.
|
2011-10-13 19:49:11 +02:00
|
|
|
|
*
|
2019-08-14 14:34:18 +02:00
|
|
|
|
****************************************************************************/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
#ifndef __BOARDS_ARM_LPC31XX_EA3152_TOOLS_LPCHDR_H
|
|
|
|
|
#define __BOARDS_ARM_LPC31XX_EA3152_TOOLS_LPCHDR_H
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
/****************************************************************************
|
2011-10-13 19:49:11 +02:00
|
|
|
|
* Included Files
|
2019-08-14 14:34:18 +02:00
|
|
|
|
****************************************************************************/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
/****************************************************************************
|
2015-04-08 17:15:17 +02:00
|
|
|
|
* Pre-processor Definitions
|
2019-08-14 14:34:18 +02:00
|
|
|
|
****************************************************************************/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
/****************************************************************************
|
2011-10-13 19:49:11 +02:00
|
|
|
|
* Public Types
|
2019-08-14 14:34:18 +02:00
|
|
|
|
****************************************************************************/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
|
|
|
|
struct lpc31_header_s
|
|
|
|
|
{
|
|
|
|
|
/* OFFS DESCRIPTION */
|
2021-03-18 09:57:48 +01:00
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
uint32_t vector; /* 0x00 Valid ARM instruction. Usually this
|
|
|
|
|
* will be a branch instruction to entry
|
|
|
|
|
* point of the image.
|
|
|
|
|
*/
|
|
|
|
|
uint32_t magic; /* 0x04 This field is used by boot ROM to
|
|
|
|
|
* detect a valid image header. This field
|
|
|
|
|
* should always be set to 0x41676d69.
|
|
|
|
|
*/
|
|
|
|
|
uint32_t execution_crc32; /* 0x08 CRC32 value of execution part of
|
|
|
|
|
* the image. If the <EFBFBD>image_type<EFBFBD> is set
|
|
|
|
|
* to <EFBFBD>0xA<EFBFBD>, this field is ignored by boot
|
|
|
|
|
* ROM.
|
|
|
|
|
*/
|
2021-03-19 08:21:24 +01:00
|
|
|
|
uint32_t reserved0[4]; /* 0x0c-0x18: Should be zero. */
|
|
|
|
|
uint32_t imagetype; /* 0x1c Specifies whether CRC check should be
|
2019-08-14 14:34:18 +02:00
|
|
|
|
* done on the image or not:
|
2011-10-13 19:49:11 +02:00
|
|
|
|
* 0xA <EFBFBD> No CRC check required.
|
|
|
|
|
* 0xB <EFBFBD> Do CRC32 check on both header and
|
2019-08-14 14:34:18 +02:00
|
|
|
|
* execution part of the image.
|
|
|
|
|
*/
|
2021-03-19 08:21:24 +01:00
|
|
|
|
uint32_t imagelength; /* 0x20 Total image length including header
|
2019-08-14 14:34:18 +02:00
|
|
|
|
* rounded up to the nearest 512 byte
|
|
|
|
|
* boundary. In C language the field can be
|
|
|
|
|
* computed as:
|
2021-03-19 08:21:24 +01:00
|
|
|
|
* imagelength = (Actual length + 511) & ~0x1FF;
|
2019-08-14 14:34:18 +02:00
|
|
|
|
*/
|
2021-03-19 08:21:24 +01:00
|
|
|
|
uint32_t releaseid; /* 0x24 Release or version number of the
|
2019-08-14 14:34:18 +02:00
|
|
|
|
* image.
|
|
|
|
|
* Note, this field is not used by boot ROM
|
|
|
|
|
* but is provided to track the image
|
|
|
|
|
* versions.
|
|
|
|
|
*/
|
2021-03-19 08:21:24 +01:00
|
|
|
|
uint32_t buildtime; /* 0x28 Time (expressed in EPOC time format) at
|
2019-08-14 14:34:18 +02:00
|
|
|
|
* which image is built. Note, this field is
|
|
|
|
|
* not used by boot ROM but is provided to
|
|
|
|
|
* track the image versions.
|
|
|
|
|
*/
|
2021-03-19 08:21:24 +01:00
|
|
|
|
uint32_t sbzbootparameter; /* 0x2c hould be zero. */
|
2019-08-14 14:34:18 +02:00
|
|
|
|
uint32_t cust_reserved[15]; /* 0x30-0x68: Reserved for customer use
|
|
|
|
|
* (60 bytes)
|
|
|
|
|
*/
|
|
|
|
|
uint32_t header_crc32; /* 0x6c CRC32 value of the header
|
|
|
|
|
* (bytes 0x00 to 0x6C of the image).
|
|
|
|
|
* If the <EFBFBD>image_type<EFBFBD> is set to <EFBFBD>0xA<EFBFBD>,
|
|
|
|
|
* this field is ignored by boot ROM.
|
|
|
|
|
*/
|
2021-03-19 08:21:24 +01:00
|
|
|
|
uint32_t reserved1[4]; /* 0x70-0x7c: Should be zero. */
|
2019-08-14 14:34:18 +02:00
|
|
|
|
/* 0x80 Start of program code (128Kb max).
|
|
|
|
|
* The final image has to be padded to the
|
|
|
|
|
* nearest 512 byte boundary
|
|
|
|
|
*/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
};
|
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
/****************************************************************************
|
2021-03-18 09:57:48 +01:00
|
|
|
|
* Public Data
|
2019-08-14 14:34:18 +02:00
|
|
|
|
****************************************************************************/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
/****************************************************************************
|
2021-03-18 09:57:48 +01:00
|
|
|
|
* Public Functions Definitions
|
2019-08-14 14:34:18 +02:00
|
|
|
|
****************************************************************************/
|
2011-10-13 19:49:11 +02:00
|
|
|
|
|
|
|
|
|
extern uint32_t crc32part(const uint8_t *src, size_t len, uint32_t crc32val);
|
|
|
|
|
extern uint32_t crc32(const uint8_t *src, size_t len);
|
|
|
|
|
|
2019-08-14 14:34:18 +02:00
|
|
|
|
#endif /* __BOARDS_ARM_LPC31XX_EA3152_TOOLS_LPCHDR_H */
|