[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 | ####################################################################################### |
---|
| 10 | # This file describes the mapping of the single thread "shell" application |
---|
| 11 | # on processor[0][0][0] of a multi-clusters, multi-processors architecture. |
---|
| 12 | #################################################################################### |
---|
| 13 | |
---|
| 14 | ###################### |
---|
| 15 | def extend( mapping ): |
---|
| 16 | |
---|
| 17 | nprocs = mapping.nprocs |
---|
| 18 | x_width = mapping.x_width |
---|
| 19 | y_width = mapping.y_width |
---|
| 20 | |
---|
| 21 | # define vsegs base & size |
---|
| 22 | code_base = 0x10000000 |
---|
| 23 | code_size = 0x00010000 # 64 Kbytes |
---|
| 24 | |
---|
| 25 | data_base = 0x20000000 |
---|
| 26 | data_size = 0x00080000 # 512 Kbytes |
---|
| 27 | |
---|
| 28 | stack_base = 0x40000000 |
---|
| 29 | stack_size = 0x00200000 # 2 Mbytes |
---|
| 30 | |
---|
| 31 | heap_base = 0x60000000 |
---|
| 32 | heap_size = 0x00001000 # 4 Kbytes |
---|
| 33 | |
---|
| 34 | # create vspace |
---|
| 35 | vspace = mapping.addVspace( name = 'shell', startname = 'shell_data' ) |
---|
| 36 | |
---|
| 37 | # data vseg |
---|
| 38 | mapping.addVseg( vspace, 'shell_data', data_base , data_size, |
---|
| 39 | 'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', |
---|
| 40 | binpath = 'build/shell/appli.elf', |
---|
| 41 | local = False ) |
---|
| 42 | |
---|
| 43 | # code vseg |
---|
| 44 | mapping.addVseg( vspace, 'shell_code', code_base , code_size, |
---|
| 45 | 'CXWU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', |
---|
| 46 | binpath = 'build/shell/appli.elf', |
---|
| 47 | local = False ) |
---|
| 48 | |
---|
| 49 | # stack vseg |
---|
| 50 | mapping.addVseg( vspace, 'shell_stack', stack_base, stack_size, |
---|
| 51 | 'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM', |
---|
| 52 | local = False, big = True ) |
---|
| 53 | |
---|
| 54 | # heap vseg (unused) |
---|
| 55 | mapping.addVseg( vspace, 'shell_heap', heap_base, heap_size, |
---|
| 56 | 'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM', |
---|
| 57 | local = False ) |
---|
| 58 | |
---|
| 59 | # task |
---|
| 60 | mapping.addTask( vspace, 'shell', 0, 0, 0, 0, 'shell_stack', 'shell_heap', 0 ) |
---|
| 61 | |
---|
| 62 | # extend mapping name |
---|
| 63 | mapping.name += '_shell' |
---|
| 64 | |
---|
| 65 | return vspace # useful for test |
---|
| 66 | |
---|
| 67 | ################################ test ###################################################### |
---|
| 68 | |
---|
| 69 | if __name__ == '__main__': |
---|
| 70 | |
---|
| 71 | vspace = extend( Mapping( 'test', 2, 2, 4 ) ) |
---|
| 72 | print vspace.xml() |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | # Local Variables: |
---|
| 76 | # tab-width: 4; |
---|
| 77 | # c-basic-offset: 4; |
---|
| 78 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
| 79 | # indent-tabs-mode: nil; |
---|
| 80 | # End: |
---|
| 81 | # |
---|
| 82 | # vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 83 | |
---|