changeset 164:3e3d1ebba956

Merged in janlmulder/ostc4/linux-build (pull request #1) Linux build finetuning
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Thu, 07 Mar 2019 14:15:33 +0000
parents e3ca52b8e7fa (current diff) 9c77cfe8c2b2 (diff)
children e9cce686fe41 255eedad4155
files
diffstat 4 files changed, 221 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ostc4pack/README.linux	Thu Mar 07 14:15:33 2019 +0000
@@ -0,0 +1,24 @@
+README.linux
+------------
+
+1. Compile the pack utilities
+
+cd src
+make checksum_final_add_fletcher
+make OSTC4pack_V4
+
+2. Edit create_full_update_bin.sh
+
+Set BUILD_PATH to the location where you build the individual parts
+of the firmware using the OpenSTM23 IDE. 
+
+Set BUILD_TYPE the either Debug or Release (or any other build style you 
+defined in the OpenSTM23 IDE).
+
+Set the "build project names" as defined in the OpenSTM23 IDE.
+
+3. Simpy run create_full_update_bin.sh
+
+Run it in the ostc4pack folder of the repository, and a file with name
+like OSTC4_<date>.bin is created containg the individual blobs.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ostc4pack/create_full_update_bin.sh	Thu Mar 07 14:15:33 2019 +0000
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+#
+# path and file name settings
+#
+
+# the build products are here
+BUILD_PATH="$HOME/OSTC4workspace"
+
+# Debug or Release build
+BUILD_TYPE="Release"
+
+# build project names
+CPU1_DISCOVERY="CPU1-Discovery"
+CPU1_FONTPACK="CPU1-FontPack"
+CPU2_RTE="CPU2-RTE"
+
+#
+# End of path and file name settings
+#
+
+#
+# Copy the bin files to pack. Build them seperately
+#
+cp $BUILD_PATH/$CPU1_DISCOVERY/$BUILD_TYPE/$CPU1_DISCOVERY.bin .
+cp $BUILD_PATH/$CPU1_FONTPACK/$BUILD_TYPE/$CPU1_FONTPACK.bin .
+cp $BUILD_PATH/$CPU2_RTE/$BUILD_TYPE/$CPU2_RTE.bin .
+
+#
+# OSTC4pack_V4 all
+#
+./src/OSTC4pack_V4 1 $CPU1_DISCOVERY.bin
+./src/OSTC4pack_V4 2 $CPU1_FONTPACK.bin
+./src/OSTC4pack_V4 0 $CPU2_RTE.bin
+
+#
+# Final pack
+#
+./src/checksum_final_add_fletcher ${CPU1_DISCOVERY}_upload.bin \
+				${CPU1_FONTPACK}_upload.bin \
+				${CPU2_RTE}_upload.bin
--- a/ostc4pack/src/OSTC4pack_V4.cpp	Thu Mar 07 15:06:43 2019 +0100
+++ b/ostc4pack/src/OSTC4pack_V4.cpp	Thu Mar 07 14:15:33 2019 +0000
@@ -411,6 +411,11 @@
 int main(int argc, char** argv) {
 	
 	
+	if (argc != 3) {
+		fprintf(stderr, "Usage: OSTC4pack_V4 <type> <bin file>\n");
+		return(-1);
+	}
+
 	FILE *fp, * fpout;
 	size_t len;
 	unsigned char buf[1050000];
@@ -440,7 +445,7 @@
 		sprintf(filenameout,"%s_upload.bin",filename);
 	else
 	if(type == 2)
-		sprintf(filenameout,"OSTC4_FONT_upload.bin",filename);
+		sprintf(filenameout,"%s_upload.bin",filename);
 	else
 		sprintf(filenameout,"%s_upload.bin",filename);
 	
@@ -513,8 +518,3 @@
     fwrite(buf2,sizeof(char),4,fp);
      
 }
-
-
-
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ostc4pack/src/crcmodel.h	Thu Mar 07 14:15:33 2019 +0000
@@ -0,0 +1,150 @@
+/******************************************************************************/
+/*                                                                            */
+/* Author : Ross Williams (ross@guest.adelaide.edu.au.).                      */
+/* Date   : 3 June 1993.                                                      */
+/* Status : Public domain.                                                    */
+/*                                                                            */
+/* Description : This is the header (.h) file for the reference               */
+/* implementation of the Rocksoft^tm Model CRC Algorithm. For more            */
+/* information on the Rocksoft^tm Model CRC Algorithm, see the document       */
+/* titled "A Painless Guide to CRC Error Detection Algorithms" by Ross        */
+/* Williams (ross@guest.adelaide.edu.au.). This document is likely to be in   */
+/* "ftp.adelaide.edu.au/pub/rocksoft".                                        */
+/*                                                                            */
+/* Note: Rocksoft is a trademark of Rocksoft Pty Ltd, Adelaide, Australia.    */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/* How to Use This Package                                                    */
+/* -----------------------                                                    */
+/* Step 1: Declare a variable of type cm_t. Declare another variable          */
+/*         (p_cm say) of type p_cm_t and initialize it to point to the first  */
+/*         variable (e.g. p_cm_t p_cm = &cm_t).                               */
+/*                                                                            */
+/* Step 2: Assign values to the parameter fields of the structure.            */
+/*         If you don't know what to assign, see the document cited earlier.  */
+/*         For example:                                                       */
+/*            p_cm->cm_width = 16;                                            */
+/*            p_cm->cm_poly  = 0x8005L;                                       */
+/*            p_cm->cm_init  = 0L;                                            */
+/*            p_cm->cm_refin = TRUE;                                          */
+/*            p_cm->cm_refot = TRUE;                                          */
+/*            p_cm->cm_xorot = 0L;                                            */
+/*         Note: Poly is specified without its top bit (18005 becomes 8005).  */
+/*         Note: Width is one bit less than the raw poly width.               */
+/*                                                                            */
+/* Step 3: Initialize the instance with a call cm_ini(p_cm);                  */
+/*                                                                            */
+/* Step 4: Process zero or more message bytes by placing zero or more         */
+/*         successive calls to cm_nxt. Example: cm_nxt(p_cm,ch);              */
+/*                                                                            */
+/* Step 5: Extract the CRC value at any time by calling crc = cm_crc(p_cm);   */
+/*         If the CRC is a 16-bit value, it will be in the bottom 16 bits.    */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/* Design Notes                                                               */
+/* ------------                                                               */
+/* PORTABILITY: This package has been coded very conservatively so that       */
+/* it will run on as many machines as possible. For example, all external     */
+/* identifiers have been restricted to 6 characters and all internal ones to  */
+/* 8 characters. The prefix cm (for Crc Model) is used as an attempt to avoid */
+/* namespace collisions. This package is endian independent.                  */
+/*                                                                            */
+/* EFFICIENCY: This package (and its interface) is not designed for           */
+/* speed. The purpose of this package is to act as a well-defined reference   */
+/* model for the specification of CRC algorithms. If you want speed, cook up  */
+/* a specific table-driven implementation as described in the document cited  */
+/* above. This package is designed for validation only; if you have found or  */
+/* implemented a CRC algorithm and wish to describe it as a set of parameters */
+/* to the Rocksoft^tm Model CRC Algorithm, your CRC algorithm implementation  */
+/* should behave identically to this package under those parameters.          */
+/*                                                                            */
+/******************************************************************************/
+
+/* The following #ifndef encloses this entire */
+/* header file, rendering it indempotent.     */
+#ifndef CM_DONE
+#define CM_DONE
+
+/******************************************************************************/
+
+/* The following definitions are extracted from my style header file which    */
+/* would be cumbersome to distribute with this package. The DONE_STYLE is the */
+/* idempotence symbol used in my style header file.                           */
+
+#ifndef DONE_STYLE
+
+typedef unsigned long ulong;
+typedef unsigned bool;
+typedef unsigned char *p_ubyte_;
+
+#ifndef TRUE
+#define FALSE 0
+#define TRUE  1
+#endif
+
+/* Change to the second definition if you don't have prototypes. */
+#define P_(A) A
+/* #define P_(A) () */
+
+/* Uncomment this definition if you don't have void. */
+/* typedef int void; */
+
+#endif
+
+/******************************************************************************/
+
+/* CRC Model Abstract Type */
+/* ----------------------- */
+/* The following type stores the context of an executing instance of the  */
+/* model algorithm. Most of the fields are model parameters which must be */
+/* set before the first initializing call to cm_ini.                      */
+typedef struct {
+ int cm_width;  /* Parameter: Width in bits [8,32].       */
+ ulong cm_poly;  /* Parameter: The algorithm's polynomial. */
+ ulong cm_init;  /* Parameter: Initial register value.     */
+ bool cm_refin;  /* Parameter: Reflect input bytes?        */
+ bool cm_refot;  /* Parameter: Reflect output CRC?         */
+ ulong cm_xorot;  /* Parameter: XOR this to output CRC.     */
+
+ ulong cm_reg;  /* Context: Context during execution.     */
+} cm_t;
+typedef cm_t *p_cm_t;
+
+/******************************************************************************/
+
+/* Functions That Implement The Model */
+/* ---------------------------------- */
+/* The following functions animate the cm_t abstraction. */
+
+void cm_ini P_((p_cm_t p_cm));
+/* Initializes the argument CRC model instance.          */
+/* All parameter fields must be set before calling this. */
+
+void cm_nxt P_((p_cm_t p_cm, int ch));
+/* Processes a single message byte [0,255]. */
+
+void cm_blk P_((p_cm_t p_cm, p_ubyte_ blk_adr, ulong blk_len));
+/* Processes a block of message bytes. */
+
+ulong cm_crc P_((p_cm_t p_cm));
+/* Returns the CRC value for the message bytes processed so far. */
+
+/******************************************************************************/
+
+/* Functions For Table Calculation */
+/* ------------------------------- */
+/* The following function can be used to calculate a CRC lookup table.        */
+/* It can also be used at run-time to create or check static tables.          */
+
+ulong cm_tab P_((p_cm_t p_cm, int index));
+/* Returns the i'th entry for the lookup table for the specified algorithm.   */
+/* The function examines the fields cm_width, cm_poly, cm_refin, and the      */
+/* argument table index in the range [0,255] and returns the table entry in   */
+/* the bottom cm_width bytes of the return value.                             */
+
+/******************************************************************************/
+
+/* End of the header file idempotence #ifndef */
+#endif