]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MicroBlaze_Spartan-6_EthernetLite/KernelAwareBSPRepository/sw_apps/FreeRTOS_Hello_World/data/FreeRTOS_Hello_World.tcl
Correct calculation of xHeapStructSize in heap_4 and heap_5.
[freertos] / FreeRTOS / Demo / MicroBlaze_Spartan-6_EthernetLite / KernelAwareBSPRepository / sw_apps / FreeRTOS_Hello_World / data / FreeRTOS_Hello_World.tcl
1 proc swapp_get_name {} {
2     return "FreeRTOS Hello World";
3 }
4
5 proc swapp_get_description {} {
6     return "Let's say 'Hello World' in FreeRTOS.";
7 }
8
9 proc get_os {} {
10     set oslist [xget_sw_modules "type" "os"];
11     set os [lindex $oslist 0];
12
13     if { $os == "" } {
14         error "No Operating System specified in the Board Support Package.";
15     }
16
17     return $os;
18 }
19
20 proc get_stdout {} {
21     set os [get_os];
22     set stdout [xget_sw_module_parameter $os "STDOUT"];
23     return $stdout;
24 }
25
26 proc check_stdout_hw {} {
27     set uartlites [xget_ips "type" "uartlite"];
28     set uart16550s [xget_ips "type" "uart16550"];
29     if { ([llength $uartlites] == 0) && ([llength $uart16550s] == 0) } {
30         # Check for MDM-Uart peripheral. The MDM would be listed as a peripheral
31         # only if it has a UART interface. So no further check is required
32         set mdmlist [xget_ips "type" "mdm"]
33         if { [llength $mdmlist] == 0 } {
34             error "This application requires a Uart IP in the hardware."
35         }
36     }
37 }
38
39 proc check_stdout_sw {} {
40     set stdout [get_stdout];
41     if { $stdout == "none" } {
42         error "The STDOUT parameter is not set on the OS. Hello World requires stdout to be set."
43     }
44 }
45
46 proc get_mem_size { memlist } {
47     return [lindex $memlist 4];
48 }
49
50 proc require_memory {memsize} {
51     set imemlist [xget_memory_ranges "access_type" "I"];
52     set idmemlist [xget_memory_ranges "access_type" "ID"];
53     set dmemlist [xget_memory_ranges "access_type" "D"];
54
55     set memlist [concat $imemlist $idmemlist $dmemlist];
56
57     while { [llength $memlist] > 3 } {
58         set mem [lrange $memlist 0 4];
59         set memlist [lreplace $memlist 0 4];
60
61         if { [get_mem_size $mem] >= $memsize } {
62             return 1;
63         }
64     }
65
66     error "This application requires atleast $memsize bytes of memory.";
67 }
68
69 proc swapp_is_supported_hw {} {
70     # check for uart peripheral
71     check_stdout_hw;
72
73     # require about 1M of memory
74     require_memory "1000000";
75
76     return 1;
77 }
78
79 proc swapp_is_supported_sw {} {
80     # check for stdout being set
81     check_stdout_sw;
82
83     return 1;
84 }
85
86 proc generate_stdout_config { fid } {
87     set stdout [get_stdout];
88
89     # if stdout is uartlite, we don't have to generate anything
90     set stdout_type [xget_ip_attribute "type" $stdout];
91
92     if { [regexp -nocase "uartlite" $stdout_type] || [string match -nocase "mdm" $stdout_type] } {
93         return;
94     } elseif { [regexp -nocase "uart16550" $stdout_type] } {
95         # mention that we have a 16550
96         puts $fid "#define STDOUT_IS_16550";
97
98         # and note down its base address
99         set prefix "XPAR_";
100         set postfix "_BASEADDR";
101         set stdout_baseaddr_macro $prefix$stdout$postfix;
102         set stdout_baseaddr_macro [string toupper $stdout_baseaddr_macro];
103         puts $fid "#define STDOUT_BASEADDR $stdout_baseaddr_macro";
104     }
105 }
106
107 # depending on the type of os (standalone|xilkernel), choose
108 # the correct source files
109 proc swapp_generate {} {
110
111     # cleanup this file for writing
112     set fid [open "platform_config.h" "w+"];
113     puts $fid "#ifndef __PLATFORM_CONFIG_H_";
114     puts $fid "#define __PLATFORM_CONFIG_H_\n";
115
116     # if we have a uart16550 as stdout, then generate some config for that
117     generate_stdout_config $fid;
118
119     puts $fid "#endif";
120     close $fid;
121 }
122
123 proc swapp_get_linker_constraints {} {
124
125     # we need a 4k heap
126     return "stack 40k heap 40k";
127 }