OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [tags/] [release-0.9/] [sw/] [utils/] [bin2c.c] - Diff between revs 2 and 42

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 42
/*$$HEADER*/
/*$$HEADER*/
/******************************************************************************/
/******************************************************************************/
/*                                                                            */
/*                                                                            */
/*                    H E A D E R   I N F O R M A T I O N                     */
/*                    H E A D E R   I N F O R M A T I O N                     */
/*                                                                            */
/*                                                                            */
/******************************************************************************/
/******************************************************************************/
 
 
// Project Name                   : ORPSoC v2
// Project Name                   : ORPSoC v2
// File Name                      : bin2c.c
// File Name                      : bin2c.c
// Prepared By                    : 
// Prepared By                    : 
// Project Start                  : 
// Project Start                  : 
 
 
/*$$COPYRIGHT NOTICE*/
/*$$COPYRIGHT NOTICE*/
/******************************************************************************/
/******************************************************************************/
/*                                                                            */
/*                                                                            */
/*                      C O P Y R I G H T   N O T I C E                       */
/*                      C O P Y R I G H T   N O T I C E                       */
/*                                                                            */
/*                                                                            */
/******************************************************************************/
/******************************************************************************/
/*
/*
  This library is free software; you can redistribute it and/or
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation;
  License as published by the Free Software Foundation;
  version 2.1 of the License, a copy of which is available from
  version 2.1 of the License, a copy of which is available from
  http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
  http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
 
 
  This library is distributed in the hope that it will be useful,
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  Lesser General Public License for more details.
 
 
  You should have received a copy of the GNU Lesser General Public
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/
*/
 
 
/*$$DESCRIPTION*/
/*$$DESCRIPTION*/
/******************************************************************************/
/******************************************************************************/
/*                                                                            */
/*                                                                            */
/*                           D E S C R I P T I O N                            */
/*                           D E S C R I P T I O N                            */
/*                                                                            */
/*                                                                            */
/******************************************************************************/
/******************************************************************************/
//
//
// Generate C file containing binary data in hex format in an array
// Generate C file containing binary data in hex format in an array
//
//
 
 
#include <stdio.h>
#include <stdio.h>
 
 
int main(void)
int main(void)
{
{
 
 
        int c, i = 0;
        int c, i = 0;
 
 
        printf("#ifdef HAVE_CONFIG_H\n");
        printf("#ifdef HAVE_CONFIG_H\n");
        printf("# include \"config.h\"\n");
        printf("# include \"config.h\"\n");
        printf("#endif\n\n");
        printf("#endif\n\n");
        printf("#ifdef EMBED\n");
        printf("#ifdef EMBED\n");
 
 
        printf("unsigned char flash_data[] = {\n");
        printf("unsigned char flash_data[] = {\n");
 
 
        while((c = getchar()) != EOF) {
        while((c = getchar()) != EOF) {
                printf("0x%.2x, ", c);
                printf("0x%.2x, ", c);
                if(!(i % 32))
                if(!(i % 32))
                        printf("\n");
                        printf("\n");
                i++;
                i++;
        }
        }
 
 
        printf(" };\n");
        printf(" };\n");
        printf("#endif\n");
        printf("#endif\n");
        return(0);
        return(0);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.