| [589] | 1 | #!/usr/bin/env python | 
|---|
 | 2 |  | 
|---|
 | 3 | from mapping import * | 
|---|
 | 4 |  | 
|---|
 | 5 | ###################################################################################### | 
|---|
 | 6 | #   file   : shell.py   | 
|---|
 | 7 | #   date   : july 2015 | 
|---|
 | 8 | #   author : Alain Greiner | 
|---|
 | 9 | ####################################################################################### | 
|---|
| [712] | 10 | #  This file describes the mapping of the single thread "shell" application.  | 
|---|
 | 11 | #  It is mapped on processor[xmap][ymap][pmap] of the target | 
|---|
 | 12 | #  multi-clusters, multi-processors architecture. | 
|---|
| [589] | 13 | #################################################################################### | 
|---|
 | 14 |  | 
|---|
 | 15 | ###################### | 
|---|
 | 16 | def extend( mapping ): | 
|---|
 | 17 |  | 
|---|
| [712] | 18 |     # define mapping  | 
|---|
 | 19 |     xmap  = mapping.x_size - 1 | 
|---|
 | 20 |     ymap  = mapping.y_size - 1 | 
|---|
 | 21 |     pmap  = mapping.nprocs - 1 | 
|---|
| [589] | 22 |  | 
|---|
 | 23 |     # define vsegs base & size | 
|---|
 | 24 |     code_base  = 0x10000000 | 
|---|
 | 25 |     code_size  = 0x00010000     # 64 Kbytes  | 
|---|
 | 26 |      | 
|---|
 | 27 |     data_base  = 0x20000000 | 
|---|
 | 28 |     data_size  = 0x00080000     # 512 Kbytes  | 
|---|
 | 29 |  | 
|---|
 | 30 |     stack_base = 0x40000000  | 
|---|
 | 31 |     stack_size = 0x00200000     # 2 Mbytes  | 
|---|
 | 32 |  | 
|---|
 | 33 |     heap_base  = 0x60000000  | 
|---|
 | 34 |     heap_size  = 0x00001000     # 4 Kbytes  | 
|---|
 | 35 |  | 
|---|
| [768] | 36 |     mmap_base  = 0x70000000 | 
|---|
 | 37 |     mmap_size  = 0x10000000     # 256 Mbytes (unmapped) | 
|---|
 | 38 |  | 
|---|
| [589] | 39 |     # create vspace | 
|---|
| [643] | 40 |     vspace = mapping.addVspace( name = 'shell', startname = 'shell_data' , active = True ) | 
|---|
| [589] | 41 |      | 
|---|
 | 42 |     # data vseg | 
|---|
 | 43 |     mapping.addVseg( vspace, 'shell_data', data_base , data_size,  | 
|---|
| [712] | 44 |                      'C_WU', vtype = 'ELF', x = xmap, y = ymap, pseg = 'RAM',  | 
|---|
| [610] | 45 |                      binpath = 'bin/shell/appli.elf', | 
|---|
| [589] | 46 |                      local = False ) | 
|---|
 | 47 |  | 
|---|
 | 48 |     # code vseg | 
|---|
 | 49 |     mapping.addVseg( vspace, 'shell_code', code_base , code_size, | 
|---|
| [712] | 50 |                      'CXWU', vtype = 'ELF', x = xmap, y = ymap, pseg = 'RAM',  | 
|---|
| [610] | 51 |                      binpath = 'bin/shell/appli.elf', | 
|---|
| [589] | 52 |                      local = False ) | 
|---|
 | 53 |  | 
|---|
 | 54 |     # stack vseg              | 
|---|
 | 55 |     mapping.addVseg( vspace, 'shell_stack', stack_base, stack_size, | 
|---|
| [712] | 56 |                      'C_WU', vtype = 'BUFFER', x = xmap , y = ymap , pseg = 'RAM', | 
|---|
| [589] | 57 |                      local = False, big = True ) | 
|---|
 | 58 |  | 
|---|
 | 59 |     # heap vseg (unused)             | 
|---|
 | 60 |     mapping.addVseg( vspace, 'shell_heap', heap_base, heap_size, | 
|---|
| [712] | 61 |                      'C_WU', vtype = 'BUFFER', x = xmap , y = ymap , pseg = 'RAM', | 
|---|
| [589] | 62 |                      local = False ) | 
|---|
 | 63 |  | 
|---|
| [768] | 64 |     # mmap vseg             | 
|---|
 | 65 |     mapping.addVseg( vspace, 'shell_mmap', mmap_base, mmap_size, | 
|---|
 | 66 |                      'C_WU', vtype = 'MMAP', x = xmap , y = ymap , pseg = 'RAM', | 
|---|
 | 67 |                      local = False ) | 
|---|
 | 68 |  | 
|---|
| [589] | 69 |     # task  | 
|---|
| [712] | 70 |     mapping.addThread( vspace,  | 
|---|
 | 71 |                        'shell',  | 
|---|
 | 72 |                        True,              # is_main | 
|---|
 | 73 |                        xmap, ymap, pmap, | 
|---|
 | 74 |                        'shell_stack', | 
|---|
 | 75 |                        'shell_heap', | 
|---|
 | 76 |                        0 )                # startid | 
|---|
| [589] | 77 |  | 
|---|
 | 78 |     # extend mapping name | 
|---|
 | 79 |     mapping.name += '_shell' | 
|---|
 | 80 |  | 
|---|
 | 81 |     return vspace  # useful for test | 
|---|
 | 82 |              | 
|---|
 | 83 | ################################ test ###################################################### | 
|---|
 | 84 |  | 
|---|
 | 85 | if __name__ == '__main__': | 
|---|
 | 86 |  | 
|---|
 | 87 |     vspace = extend( Mapping( 'test', 2, 2, 4 ) ) | 
|---|
 | 88 |     print vspace.xml() | 
|---|
 | 89 |  | 
|---|
 | 90 |  | 
|---|
 | 91 | # Local Variables: | 
|---|
 | 92 | # tab-width: 4; | 
|---|
 | 93 | # c-basic-offset: 4; | 
|---|
 | 94 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); | 
|---|
 | 95 | # indent-tabs-mode: nil; | 
|---|
 | 96 | # End: | 
|---|
 | 97 | # | 
|---|
 | 98 | # vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
 | 99 |  | 
|---|