Changeset 791 for soft


Ignore:
Timestamp:
Feb 17, 2016, 4:12:02 PM (9 years ago)
Author:
meunier
Message:
  • Added function realloc
  • Started to put the bootloader on 2 Big Pages (warning: does not work yet)
  • Fixed errors in the rosenfeld application
Location:
soft/giet_vm
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/Makefile

    r788 r791  
    453453### rosenfeld  application compilation
    454454### update rosenfeld/appli.elf on virtual disk
    455 applications/rosenfeld/appli.elf: build/libs/libuser.a
     455applications/rosenfeld/appli.elf: build/libs/libuser.a build/libs/libmath.a
    456456        $(MAKE) -C applications/rosenfeld
    457         mcopy -o -i $(DISK_IMAGE) applications/rosenfeld/appli.elf ::/bin/router
     457        mcopy -o -i $(DISK_IMAGE) applications/rosenfeld/appli.elf ::/bin/rosenfeld
    458458
    459459########################################
  • soft/giet_vm/applications/rosenfeld/Makefile

    r772 r791  
    1919
    2020
    21 APP_NAME = rosenfeld
     21APP_NAME = appli.elf
    2222
    2323SRC_FILE = $(wildcard $(SRC_PATH)/*.c)
     
    3232CFLAGS := $(CFLAGS) -g -Wall -fomit-frame-pointer $(CFLAGSW) $(CFLAGSCPU) -I$(INC_PATH) -fno-builtin -ffreestanding
    3333
    34 LDFLAGS := -Lnrc2 -L../../build/libs -T$(APP_NAME).ld --start-group -lnrc2x -luser -lmath --end-group
     34LDFLAGS := -Lnrc2 -L../../build/libs -Trosenfeld.ld --start-group -lnrc2x -luser -lmath --end-group
    3535
    3636
  • soft/giet_vm/applications/rosenfeld/nrc2/include/nrc_os_config.h

    r772 r791  
    1010    #define write(x, y, z)  giet_fat_write(x, y, z)
    1111    #define fprintf(x, ...) giet_fat_fprintf(x, __VA_ARGS__)
    12     #define exit(x)         giet_pthread_exit("exit...")
     12    #define fscanf(x, ...)  ;
     13    #define exit(x)         giet_pthread_exit(NULL)
    1314#endif
    1415
  • soft/giet_vm/applications/rosenfeld/rosenfeld.ld

    r772 r791  
    33*****************************************************************************/
    44
    5 seg_code_base      = 0x00400000;
    6 seg_data_base      = 0x00500000;
     5seg_code_base      = 0x10000000;
     6seg_data_base      = 0x20000000;
    77
    88/***************************************************************************
  • soft/giet_vm/applications/rosenfeld/rosenfeld.py

    r772 r791  
    3535    # define vsegs base & size
    3636    code_base  = 0x10000000
    37     code_size  = 0x00010000     # 64 Kbytes (replicated in each cluster)
     37    code_size  = 0x00030000     # 192 Kbytes (replicated in each cluster)
    3838   
    3939    data_base  = 0x20000000
     
    4141
    4242    stack_base = 0x40000000
    43     stack_size = 0x00200000     # 2 Mbytes (per cluster)
     43    stack_size = 0x00800000     # 8 Mbytes (per cluster)
    4444
    4545    heap_base  = 0x60000000
     
    4747
    4848    # create vspace
    49     vspace = mapping.addVspace( name = 'rosenfled', startname = 'rosen_data' )
     49    vspace = mapping.addVspace( name = 'rosenfeld', startname = 'rosen_data' )
    5050   
    5151    # data vseg : shared (only in cluster[0,0])
    5252    mapping.addVseg( vspace, 'rosen_data', data_base, data_size,
    5353                     'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM',
    54                      binpath = 'bin/rosenfled/appli.elf',
     54                     binpath = 'bin/rosenfeld/appli.elf',
    5555                     local = False )
    5656
     
    6464                                 code_base , code_size,
    6565                                 'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM',
    66                                  binpath = 'bin/rosenfled/appli.elf',
     66                                 binpath = 'bin/rosenfeld/appli.elf',
    6767                                 local = True )
    6868
  • soft/giet_vm/applications/rosenfeld/src/ecc_examples.c

    r772 r791  
    2222#include "ecc_features.h"
    2323#include "ecc_generation.h"
     24
    2425
    2526// --------------------------------------------------------------
     
    14161417    set_ui8vector_str(X[i++], 0, w-1, "                              "); // 27
    14171418   
    1418     display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_boulon1"); printf("");
    1419     write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_boulon1.txt");
    1420 }
     1419    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_boulon1");
     1420    printf("");
     1421    write_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_boulon1.txt");
     1422}
  • soft/giet_vm/applications/rosenfeld/src/ecc_generation.c

    r777 r791  
    2121#include "mt19937.h" // Mersenne Twister generator
    2222#include "ecc_generation.h"
     23
    2324
    2425// -------------------------------------------------------------------------------------------------------------------------
  • soft/giet_vm/applications/rosenfeld/src/ecc_main_rosenfeld_sa.c

    r777 r791  
    9292    init_forme_boulon1(&X0, &i0, &i1, &j0, &j1);
    9393
    94     // allocatin memoire
     94    // allocation memoire
    9595    X   = ui8matrix (i0-border, i1+border, j0-border, j1+border);
    9696    E8  = ui8matrix (i0-border, i1+border, j0-border, j1+border);
    9797    E32 = ui32matrix(i0-border, i1+border, j0-border, j1+border);
    98     
    99     // initialisation de la memoir
     98 
     99    // initialisation de la memoire
    100100    zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border);
    101101    zero_ui8matrix (E8,  i0-border, i1+border, j0-border, j1+border);
    102102    zero_ui8matrix (X,   i0-border, i1+border, j0-border, j1+border);
    103    
     103
    104104    // pre-traitements
    105105    binarisation_ui8matrix(X0, i0, i1, j0, j1, 1, 1, X);    // pour le traitement
     
    182182    int na;
    183183   
    184     RegionStats *Stats = NULL;
     184    RegionStats * Stats = NULL;
    185185
    186186    RGBQuad palette[256];
     
    191191
    192192    // chargement d'une image depuis le disque
    193     X0 = LoadPGM_ui8matrix(complete_filename, &i0, &i1, &j0, &j1);
    194    
    195     // allocatin memoire
    196     X   = ui8matrix (i0-border, i1+border, j0-border, j1+border);
    197     E8  = ui8matrix (i0-border, i1+border, j0-border, j1+border);
    198     E32 = ui32matrix(i0-border, i1+border, j0-border, j1+border);
    199 
    200     // initialisation de la memoir
    201     zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border);
    202     zero_ui8matrix (E8,  i0-border, i1+border, j0-border, j1+border);
    203     zero_ui8matrix (X,   i0-border, i1+border, j0-border, j1+border);
     193    //X0 = LoadPGM_ui8matrix(complete_filename, &i0, &i1, &j0, &j1);
     194    init_forme_boulon1(&X0, &i0, &i1, &j0, &j1);
     195   
     196    // allocation memoire
     197    X   = ui8matrix (i0 - border, i1 + border, j0 - border, j1 + border);
     198    E8  = ui8matrix (i0 - border, i1 + border, j0 - border, j1 + border);
     199    E32 = ui32matrix(i0 - border, i1 + border, j0 - border, j1 + border);
     200
     201    // initialisation de la memoire
     202    zero_ui32matrix(E32, i0 - border, i1 + border, j0 - border, j1 + border);
     203    zero_ui8matrix (E8,  i0 - border, i1 + border, j0 - border, j1 + border);
     204    zero_ui8matrix (X,   i0 - border, i1 + border, j0 - border, j1 + border);
    204205
    205206    // pre-traitements
    206207    binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 1, X); // pour le traitement
    207     binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 255, X0); // pour la verif visuelle
    208     generate_path_filename(pathDst, "verif.pgm", complete_filename, 1024);
    209     SavePGM_ui8matrix(X0, i0, i1, j0, j1, complete_filename);
    210 
    211     height = i1-i0+1; width = j1-j0+1;
    212    
    213     nemax = ((height+1)*(width+1)) / 2; // majorant strict
    214     nermax = (width+1) / 2;
     208    //binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 255, X0); // pour la verif visuelle
     209    //generate_path_filename(pathDst, "verif.pgm", complete_filename, 1024);
     210    //SavePGM_ui8matrix(X0, i0, i1, j0, j1, complete_filename);
     211
     212    height = i1 - i0 + 1;
     213    width  = j1 - j0 + 1;
     214   
     215    nemax = ((height + 1) * (width + 1)) / 2; // majorant strict
     216    nermax = (width + 1) / 2;
    215217   
    216218    // alloc init des tables d'equivalences pour UF, Suzuki et Bailey
     
    234236    na = Rosenfeld_UF_Org1_8C(X, height, width, E32, T, A, nemax, Stats);
    235237    printf("na = %d\n", na);
    236     filename = "Rosenfeld_UF_Org1_8C.bmp";
     238    //filename = "Rosenfeld_UF_Org1_8C.bmp";
    237239    mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8);
    238     generate_path_filename(pathDst, filename, complete_filename, 1024);
    239     SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename);
     240    //generate_path_filename(pathDst, filename, complete_filename, 1024);
     241    //SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename);
    240242    zero_ui32matrix(E32, i0 - border, i1 + border, j0 - border, j1 + border);
    241243    display_RegionStatsVector(Stats, 1, na, "Stats");
     
    313315// -----------------------------
    314316{
     317#if TARGET_OS==GIET_VM
     318    giet_tty_alloc(1);
     319#endif
    315320    display_arg(argc, argv);
    316321    ecc_info_define();
  • soft/giet_vm/create_dmg

    r755 r791  
    66sector_size=512
    77sectors_per_cluster=8
    8 reserved_sectors=2048
     8reserved_sectors=4096
    99
    1010# FAT32 SPEC: The first two clusters are not present in the data region but
  • soft/giet_vm/giet_boot/boot.c

    r757 r791  
    714714
    715715////////////////////////////////////////////////////////////////////////////////
    716 // This function should be executed by P[0][0][0] only. It complete the
     716// This function should be executed by P[0][0][0] only. It completes the
    717717// page table initialisation, taking care of all global vsegs that are
    718718// not mapped in a cluster containing a processor, and have not been
     
    12161216
    12171217#if BOOT_DEBUG_MAPPING
    1218 _printf("\n[BOOT DEBUG] boot_mapin_init() : enter\n");
     1218_printf("\n[BOOT DEBUG] boot_mapping_init() : enter\n");
    12191219#endif
    12201220
  • soft/giet_vm/giet_common/vmem.c

    r758 r791  
    129129    unsigned int    ix1 = vpn >> 9;         // 11 bits for ix1
    130130
     131    //_printf("\n[GIET INFO] %s: mapping vaddr %x to paddr %l\n", __func__, (vpn << 12), (unsigned long long int) (ppn << 12));
    131132    // get PT1 physical base address
    132133    paddr_t  pt1_base = _ptabs_paddr[vspace_id][x][y];
  • soft/giet_vm/giet_config.h

    r770 r791  
    4848/* software parameters */
    4949
    50 #define GIET_ELF_BUFFER_SIZE      0x80000      /* buffer for .elf files  */
     50#define GIET_ELF_BUFFER_SIZE      0xC0000      /* buffer for .elf files  */
    5151#define GIET_IDLE_THREAD_PERIOD   0x10000000   /* Idle Task message period */
    5252#define GIET_OPEN_FILES_MAX       16           /* max simultaneously open files */
  • soft/giet_vm/giet_libs/malloc.c

    r781 r791  
    305305}
    306306
     307
     308/////////////////////////////////////////////////
     309// Added by QM
     310// Warning, I can't have tested this function yet
     311/////////////////////////////////////////////////
     312void * realloc ( void * ptr, int size )
     313{
     314    if ( ptr == NULL )
     315    {
     316        return malloc( size );
     317    }
     318    if ( size == 0 )
     319    {
     320        free( ptr );
     321        return NULL;
     322    }
     323    unsigned int x;
     324    unsigned int y;
     325    giet_get_xy( ptr, &x, &y );
     326    unsigned int base = (unsigned int) ptr;
     327    int index = (base - heap[x][y].heap_base) / MIN_BLOCK_SIZE;
     328
     329    char * pchar = (char *) (heap[x][y].alloc_base + index);
     330    int old_size = 1 << ((int) *pchar);
     331
     332    void * new_ptr = malloc( size );
     333    int min_size = (size < old_size) ? size : old_size;
     334    memcpy( new_ptr, ptr, min_size );
     335    free( ptr );
     336    return new_ptr;
     337}
     338
     339
     340
    307341///////////////////////////////////////////
    308342void update_free_array( giet_heap_t* heap,
  • soft/giet_vm/giet_libs/malloc.h

    r781 r791  
    9696extern void * calloc( int nbmem,
    9797                      int size );
     98extern void * realloc ( void * ptr,
     99                        int size );
    98100
    99101extern void * remote_malloc( int size,
Note: See TracChangeset for help on using the changeset viewer.