##// END OF EJS Templates
wraped printf for simulator.
Jeandet Alexis -
r89:68078fc5f465 dev_alexis
parent child
Show More
@@ -1,332 +1,333
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2011, Alexis Jeandet
3 -- Copyright (C) 2011, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
20 -- Mail : alexis.jeandet@member.fsf.org
21 -------------------------------------------------------------------------------*/
21 -------------------------------------------------------------------------------*/
22 #include "bsp.h"
22 #include "bsp.h"
23 #include <streamdevices.h>
23 #include <streamdevices.h>
24 #include <malloc.h>
24 #include <malloc.h>
25 #include <stdio.h>
25 #include <stdio.h>
26
26
27
27
28 uint32_t OSC0 =8000000;
28 uint32_t OSC0 =8000000;
29 uint32_t INTOSC =16000000;
29 uint32_t INTOSC =16000000;
30 uint32_t RTCOSC =32768;
30 uint32_t RTCOSC =32768;
31 uint32_t currentCpuFreq=0;
31 uint32_t currentCpuFreq=0;
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
32 extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
33
33
34
34
35 LCD_IF_t lcdIF0={
35 LCD_IF_t lcdIF0={
36 .init = &SDLCD_init,
36 .init = &SDLCD_init,
37 .writereg = &SDLCD_writereg,
37 .writereg = &SDLCD_writereg,
38 .readreg = &SDLCD_readreg,
38 .readreg = &SDLCD_readreg,
39 .writeGRAM = &SDLCD_writeGRAM_16bpp,
39 .writeGRAM = &SDLCD_writeGRAM_16bpp,
40 .readGRAM = &SDLCD_readGRAM_16bpp
40 .readGRAM = &SDLCD_readGRAM_16bpp
41 };
41 };
42
42
43 LCD_t lcd0={
43 LCD_t lcd0={
44 .interface = &lcdIF0,
44 .interface = &lcdIF0,
45 .init = &ili9328init,
45 .init = &ili9328init,
46 .paint = &ili9328paint,
46 .paint = &ili9328paint,
47 .paintText = &ili9328paintText,
47 .paintText = &ili9328paintText,
48 .paintFilRect = &ili9328paintFilRect,
48 .paintFilRect = &ili9328paintFilRect,
49 .getPix = &ili9328getPix,
49 .getPix = &ili9328getPix,
50 .refreshenable = &ili9328refreshenable,
50 .refreshenable = &ili9328refreshenable,
51 .width= 600,
51 .width= 600,
52 .height = 800
52 .height = 800
53 };
53 };
54
54
55 terminal_t terminal0;
55 terminal_t terminal0;
56
56
57 volatile int8_t* lcd0_CMD=(volatile int8_t*) 0x60000000;
57 volatile int8_t* lcd0_CMD=(volatile int8_t*) 0x60000000;
58 volatile int8_t* lcd0_DATA=(volatile int8_t*)(0x61FFFFF0);
58 volatile int8_t* lcd0_DATA=(volatile int8_t*)(0x61FFFFF0);
59
59
60 float VREF0 =(float)3.3;
60 float VREF0 =(float)3.3;
61 volatile vs10XXDev audioCodec0;
61 volatile vs10XXDev audioCodec0;
62
62
63 sdcardDev sdcard2;
63 sdcardDev sdcard2;
64 blkdevice sdcard2blkdev;
64 blkdevice sdcard2blkdev;
65 dikpartition sdcard2Part1;
65 dikpartition sdcard2Part1;
66 FAT32fs sdcard2FAT32part1;
66 FAT32fs sdcard2FAT32part1;
67 dikpartition sdcard2Part2;
67 dikpartition sdcard2Part2;
68 FAT32fs sdcard2FAT32part2;
68 FAT32fs sdcard2FAT32part2;
69 dikpartition sdcard2Part3;
69 dikpartition sdcard2Part3;
70 FAT32fs sdcard2FAT32part3;
70 FAT32fs sdcard2FAT32part3;
71 dikpartition sdcard2Part4;
71 dikpartition sdcard2Part4;
72 FAT32fs sdcard2FAT32part4;
72 FAT32fs sdcard2FAT32part4;
73
73
74
75
74 int bsp_init()
76 int bsp_init()
75 {
77 {
76 int i=0;
78 int i=0;
77 for(i=0;i<__MAX_OPENED_FILES__;i++)
79 for(i=0;i<__MAX_OPENED_FILES__;i++)
78 {
80 {
79 __opnfiles__[i] = NULL;
81 __opnfiles__[i] = NULL;
80 }
82 }
81 bsp_GPIO_init();
83 bsp_GPIO_init();
82 bsp_uart_init();
84 bsp_uart_init();
83 bsp_iic_init();
85 bsp_iic_init();
84 bsp_FSMC_init();
86 bsp_FSMC_init();
85 bsp_GTerm_init();
87 bsp_GTerm_init();
86 bsp_spi_init();
88 bsp_spi_init();
87 bsp_SD_init();
89 bsp_SD_init();
88 bsp_Audio_init();
90 bsp_Audio_init();
89 printf("\r=====================\n\r");
91 printf("\r=====================\n\r");
90 printf( "=====================\n\r");
92 printf( "=====================\n\r");
91 printf(BSP);
93 printf(BSP);
92 printf(" initialised\n\r");
94 printf(" initialised\n\r");
93 printf( "=====================\n\r");
95 printf( "=====================\n\r");
94 return 1;
96 return 1;
95 }
97 }
96
98
97 void bsp_GPIO_init()
99 void bsp_GPIO_init()
98 {
100 {
99
101
100 }
102 }
101
103
102 void bsp_uart_init()
104 void bsp_uart_init()
103 {
105 {
104
106
105 }
107 }
106
108
107 /*
109 /*
108 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
110 D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7
109 D5 PE8 D6 PE9 D7 PE10
111 D5 PE8 D6 PE9 D7 PE10
110 A20 PE4 = RS FSMC_NE1 PD7 CS FSMC_NWE PD5 W/S
112 A20 PE4 = RS FSMC_NE1 PD7 CS FSMC_NWE PD5 W/S
111 FSMC_NOE PD4 RD
113 FSMC_NOE PD4 RD
112 */
114 */
113
115
114 int bsp_FSMC_init()
116 int bsp_FSMC_init()
115 {
117 {
116
118
117 return 1;
119 return 1;
118 }
120 }
119
121
120 void bsp_spi_init()
122 void bsp_spi_init()
121 {
123 {
122
124
123 }
125 }
124
126
125
127
126 void bsp_iic_init()
128 void bsp_iic_init()
127 {
129 {
128
130
129 }
131 }
130
132
131
133
132 void bsp_Audio_init()
134 void bsp_Audio_init()
133 {
135 {
134
136
135 }
137 }
136
138
137 void bsp_SD_init()
139 void bsp_SD_init()
138 {
140 {
139 sdcardspimakeblkdev(&sdcard2blkdev,&sdcard2, bspsdcardselect,bsppowersdcard,bspsdcardpresent,bspsdcardwriteprotected);
141 sdcardspimakeblkdev(&sdcard2blkdev,&sdcard2, bspsdcardselect,bsppowersdcard,bspsdcardpresent,bspsdcardwriteprotected);
140 if(sdcard2blkdev.initialize(&sdcard2blkdev)!=STA_NOINIT)
142 if(sdcard2blkdev.initialize(&sdcard2blkdev)!=STA_NOINIT)
141 {
143 {
142 if(mbropen(&sdcard2blkdev,&sdcard2Part1,1)==MBRnoErr)
144 if(mbropen(&sdcard2blkdev,&sdcard2Part1,1)==MBRnoErr)
143 {
145 {
144 if(FATnoErr!=fat32open(&sdcard2FAT32part1,&sdcard2Part1))
146 if(FATnoErr!=fat32open(&sdcard2FAT32part1,&sdcard2Part1))
145 printf("Can't open fat32 partition 1\n");
147 printf("Can't open fat32 partition 1\n");
146 }
148 }
147 else
149 else
148 {
150 {
149 printf("Can't open or read MBR\n");
151 printf("Can't open or read MBR\n");
150 }
152 }
151 delay_100us(1000);
153 delay_100us(1000);
152 if(mbropen(&sdcard2blkdev,&sdcard2Part2,2)==MBRnoErr)
154 if(mbropen(&sdcard2blkdev,&sdcard2Part2,2)==MBRnoErr)
153 {
155 {
154 if(FATnoErr!=fat32open(&sdcard2FAT32part2,&sdcard2Part2))
156 if(FATnoErr!=fat32open(&sdcard2FAT32part2,&sdcard2Part2))
155 printf("Can't open fat32 partition 2\n");
157 printf("Can't open fat32 partition 2\n");
156 }
158 }
157 else
159 else
158 {
160 {
159 printf("Can't open or read MBR\n");
161 printf("Can't open or read MBR\n");
160 }
162 }
161 delay_100us(1000);
163 delay_100us(1000);
162 if(mbropen(&sdcard2blkdev,&sdcard2Part3,3)==MBRnoErr)
164 if(mbropen(&sdcard2blkdev,&sdcard2Part3,3)==MBRnoErr)
163 {
165 {
164 if(FATnoErr!=fat32open(&sdcard2FAT32part3,&sdcard2Part3))
166 if(FATnoErr!=fat32open(&sdcard2FAT32part3,&sdcard2Part3))
165 printf("Can't open fat32 partition 3\n");
167 printf("Can't open fat32 partition 3\n");
166 }
168 }
167 else
169 else
168 {
170 {
169 printf("Can't open or read MBR\n");
171 printf("Can't open or read MBR\n");
170 }
172 }
171 delay_100us(1000);
173 delay_100us(1000);
172 if(mbropen(&sdcard2blkdev,&sdcard2Part4,4)==MBRnoErr)
174 if(mbropen(&sdcard2blkdev,&sdcard2Part4,4)==MBRnoErr)
173 {
175 {
174 if(FATnoErr!=fat32open(&sdcard2FAT32part4,&sdcard2Part4))
176 if(FATnoErr!=fat32open(&sdcard2FAT32part4,&sdcard2Part4))
175 printf("Can't open fat32 partition 4\n");
177 printf("Can't open fat32 partition 4\n");
176 }
178 }
177 else
179 else
178 {
180 {
179 printf("Can't open or read MBR\n");
181 printf("Can't open or read MBR\n");
180 }
182 }
181 }
183 }
182 else
184 else
183 {
185 {
184 printf("Can't initialize SDCARD\n");
186 printf("Can't initialize SDCARD\n");
185 }
187 }
186
188
187 delay_100us(2000);
189 delay_100us(2000);
188 }
190 }
189
191
190 void vs1052setXCS(char val)
192 void vs1052setXCS(char val)
191 {
193 {
192 }
194 }
193
195
194 void vs1052setXDCS(char val)
196 void vs1052setXDCS(char val)
195 {
197 {
196 }
198 }
197
199
198 void vs1052setRST(char val)
200 void vs1052setRST(char val)
199 {
201 {
200 }
202 }
201
203
202 int vs10XXDREQ()
204 int vs10XXDREQ()
203 {
205 {
204 return 1;
206 return 1;
205 }
207 }
206
208
207
209
208 void bsppowersdcard(char onoff) //always ON
210 void bsppowersdcard(char onoff) //always ON
209 {
211 {
210
212
211 }
213 }
212
214
213 char bspsdcardpresent()
215 char bspsdcardpresent()
214 {
216 {
215 return 1;
217 return 1;
216 }
218 }
217
219
218 char bspsdcardwriteprotected()
220 char bspsdcardwriteprotected()
219 {
221 {
220 return 0;
222 return 0;
221 }
223 }
222
224
223 void bspsdcardselect(char YESNO)
225 void bspsdcardselect(char YESNO)
224 {
226 {
225
227
226 }
228 }
227
229
228
230
229 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
231 void bsp_lcd0_write_reg(uint32_t reg,uint32_t data)
230 {
232 {
231
233
232 }
234 }
233
235
234 uint32_t bsp_lcd0_read_reg(uint32_t reg)
236 uint32_t bsp_lcd0_read_reg(uint32_t reg)
235 {
237 {
236 return 0;
238 return 0;
237 }
239 }
238
240
239 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
241 void bsp_lcd0_writeGRAM(void* buffer,uint32_t count)
240 {
242 {
241
243
242 }
244 }
243
245
244 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
246 void bsp_lcd0_readGRAM(void* buffer,uint32_t count)
245 {
247 {
246
248
247 }
249 }
248
250
249 void bsp_GTerm_init()
251 void bsp_GTerm_init()
250 {
252 {
251 SDLCD_mkscreen(lcd0.width,lcd0.height,16,LCDILI9328);
253 SDLCD_mkscreen(lcd0.width,lcd0.height,16,LCDILI9328);
252
254
253 if(__opnfiles__[1]==NULL)
255 if(__opnfiles__[1]==NULL)
254 {
256 {
255 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
257 streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
256 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_18,fd1);
258 terminal_init(&terminal0 ,&lcd0,&ComicSansMS_18,fd1);
257 lcd0.paintFilRect(&lcd0,0,0,lcd0.width,lcd0.height,0,0,0x0f0f);
259 lcd0.paintFilRect(&lcd0,0,0,lcd0.width,lcd0.height,0,0,0x0f0f);
258 __opnfiles__[1] = fd1;
260 __opnfiles__[1] = fd1;
259 }
261 }
260 else
262 else
261 {
263 {
262
264
263 }
265 }
264 }
266 }
265
267
266
268
267
269
268
270
269
271
270
272
271
273
272 void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
274 void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
273 {
275 {
274 int bpp = surface->format->BytesPerPixel;
276 int bpp = surface->format->BytesPerPixel;
275 /* Here p is the address to the pixel we want to set */
277 /* Here p is the address to the pixel we want to set */
276 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
278 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
277 switch(bpp) {
279 switch(bpp) {
278 case 1:
280 case 1:
279 *p = pixel;
281 *p = pixel;
280 break;
282 break;
281 case 2:
283 case 2:
282 *(Uint16 *)p = pixel;
284 *(Uint16 *)p = pixel;
283 break;
285 break;
284 case 3:
286 case 3:
285 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
287 if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
286 p[0] = (pixel >> 16) & 0xff;
288 p[0] = (pixel >> 16) & 0xff;
287 p[1] = (pixel >> 8) & 0xff;
289 p[1] = (pixel >> 8) & 0xff;
288 p[2] = pixel & 0xff;
290 p[2] = pixel & 0xff;
289 } else {
291 } else {
290 p[0] = pixel & 0xff;
292 p[0] = pixel & 0xff;
291 p[1] = (pixel >> 8) & 0xff;
293 p[1] = (pixel >> 8) & 0xff;
292 p[2] = (pixel >> 16) & 0xff;
294 p[2] = (pixel >> 16) & 0xff;
293 }
295 }
294 break;
296 break;
295 case 4:
297 case 4:
296 *(Uint32 *)p = pixel;
298 *(Uint32 *)p = pixel;
297 break;
299 break;
298 }
300 }
299 }
301 }
300
302
301 Uint32 getpixel(SDL_Surface *surface, int x, int y)
303 Uint32 getpixel(SDL_Surface *surface, int x, int y)
302 {
304 {
303 int bpp = surface->format->BytesPerPixel;
305 int bpp = surface->format->BytesPerPixel;
304 /* Here p is the address to the pixel we want to retrieve */
306 /* Here p is the address to the pixel we want to retrieve */
305 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
307 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
306 switch(bpp) {
308 switch(bpp) {
307 case 1:
309 case 1:
308 return *p;
310 return *p;
309 case 2:
311 case 2:
310 return *(Uint16 *)p;
312 return *(Uint16 *)p;
311 case 3:
313 case 3:
312 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
314 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
313 return p[0] << 16 | p[1] << 8 | p[2];
315 return p[0] << 16 | p[1] << 8 | p[2];
314 else
316 else
315 return p[0] | p[1] << 8 | p[2] << 16;
317 return p[0] | p[1] << 8 | p[2] << 16;
316 case 4:
318 case 4:
317 return *(Uint32 *)p;
319 return *(Uint32 *)p;
318 default:
320 default:
319 return 0;
321 return 0;
320 }
322 }
321 /* shouldn’t happen, but avoids warnings */
323 /* shouldn’t happen, but avoids warnings */
322 }
324 }
323
325
324
326
325
327
326
328
327
329
328
330
329
331
330
332
331
333
332
@@ -1,19 +1,23
1
1
2 #include <stdio.h>
2 #include <stdio.h>
3 #include <fat32.h>
3 #include <fat32.h>
4 #include <ucdirent.h>
4 #include <ucdirent.h>
5 #include <stdarg.h>
6 #include <streamdevices.h>
7
8
5
9
6 void printRootClustersChain(FAT32fs* sdcard2FAT32part)
10 void printRootClustersChain(FAT32fs* sdcard2FAT32part)
7 {
11 {
8 ucdirent root;
12 ucdirent root;
9 uint32_t sector_lba,res,tmp=sdcard2FAT32part->cluster_begin_lba;
13 uint32_t sector_lba,res,tmp=sdcard2FAT32part->cluster_begin_lba;
10 sector_lba=tmp;
14 sector_lba=tmp;
11 do
15 do
12 {
16 {
13 printf("Sector @0x%x\n",tmp);
17 printf("Sector @0x%x\n",tmp);
14 //sector_lba=tmp+sdcard2FAT32part->BPB_SecPerClus-1;
18 //sector_lba=tmp+sdcard2FAT32part->BPB_SecPerClus-1;
15 sector_lba=tmp;
19 sector_lba=tmp;
16 res=fat32nextsectorlba(sdcard2FAT32part,sector_lba,&tmp);
20 res=fat32nextsectorlba(sdcard2FAT32part,sector_lba,&tmp);
17 }while((res==DIRENT_noErr)&&(res!=DIRENT_LastSect));
21 }while((res==DIRENT_noErr)&&(res!=DIRENT_LastSect));
18
22
19 }
23 }
@@ -1,47 +1,45
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the libuc, microcontroler library
2 -- This file is a part of the libuc, microcontroler library
3 -- Copyright (C) 2013, Alexis Jeandet
3 -- Copyright (C) 2013, Alexis Jeandet
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /** @author Alexis Jeandet alexis.jeandet@member.fsf.org
19 /** @author Alexis Jeandet alexis.jeandet@member.fsf.org
20 -------------------------------------------------------------------------------*/
20 -------------------------------------------------------------------------------*/
21 /**
21 /**
22 * This file is a simple hello world example it should run on any supported
22 * This file is a simple hello world example it should run on any supported
23 * board/architecture couple. To change target board and architecture modify
23 * board/architecture couple. To change target board and architecture modify
24 * the project file. The value BSP contains the board name, and UCMODEL contain
24 * the project file. The value BSP contains the board name, and UCMODEL contain
25 * the target architecture.
25 * the target architecture.
26 */
26 */
27 #include <stdio.h>
28
29
27
30 int libuc_main()
28 int libuc_main()
31 {
29 {
32 /**
30 /**
33 Depending on the board the printf can be directed on one uart or LCD screen or
31 Depending on the board the printf can be directed on one uart or LCD screen or
34 any other stream device.
32 any other stream device.
35 */
33 */
36 printf("hello world\n\r");
34 printf("hello world\n\r");
37 return 0;
35 return 0;
38 }
36 }
39
37
40
38
41
39
42
40
43
41
44
42
45
43
46
44
47
45
@@ -1,41 +1,41
1 #
1 #
2 # qmake configuration for simulator
2 # qmake configuration for simulator
3 #
3 #
4
4
5 CONFIG +=
5 CONFIG +=
6 QMAKE_CC = gcc
6 QMAKE_CC = gcc
7 QMAKE_CFLAGS += -g -O0
7 QMAKE_CFLAGS += -g -O0
8 QMAKE_CFLAGS_DEPS += -M
8 QMAKE_CFLAGS_DEPS += -M
9 QMAKE_CFLAGS_WARN_ON += -Wall
9 QMAKE_CFLAGS_WARN_ON += -Wall
10 QMAKE_CFLAGS_WARN_OFF += -w
10 QMAKE_CFLAGS_WARN_OFF += -w
11 QMAKE_CFLAGS_RELEASE += -O2
11 QMAKE_CFLAGS_RELEASE += -O2
12 QMAKE_CFLAGS_DEBUG +=
12 QMAKE_CFLAGS_DEBUG +=
13
13
14 QMAKE_CXX = g++
14 QMAKE_CXX = g++
15 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS s
15 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS s
16 QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
16 QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
17 QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON
17 QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON
18 QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF
18 QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF
19 QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
19 QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
20 QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
20 QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
21 QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
21 QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
22 QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB
22 QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB
23 QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
23 QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
24 QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS
24 QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS
25
25
26 QMAKE_LINK = gcc
26 QMAKE_LINK = gcc
27 QMAKE_LINK_SHLIB = gcc
27 QMAKE_LINK_SHLIB = gcc
28 QMAKE_LINK_C = gcc
28 QMAKE_LINK_C = gcc
29 QMAKE_LINK_C_SHLIB = gcc
29 QMAKE_LINK_C_SHLIB = gcc
30 QMAKE_LFLAGS += -g -O0
30 QMAKE_LFLAGS += -g -O0 -Wl,-wrap,printf -Wl,-wrap,puts
31 QMAKE_LFLAGS_RELEASE +=
31 QMAKE_LFLAGS_RELEASE +=
32 QMAKE_LFLAGS_DEBUG +=
32 QMAKE_LFLAGS_DEBUG +=
33 QMAKE_LFLAGS_APP +=
33 QMAKE_LFLAGS_APP +=
34 QMAKE_LFLAGS_SHLIB +=
34 QMAKE_LFLAGS_SHLIB +=
35 QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB
35 QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB
36 QMAKE_LFLAGS_THREAD +=
36 QMAKE_LFLAGS_THREAD +=
37
37
38 QMAKE_AR = ar -ru
38 QMAKE_AR = ar -ru
39 QMAKE_LIB = ar -ru
39 QMAKE_LIB = ar -ru
40 QMAKE_RANLIB =
40 QMAKE_RANLIB =
41
41
@@ -1,7 +1,35
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <streamdevices.h>
1
4
5 extern streamdevice* __opnfiles__[];
6
7 extern int __real_printf(const char *format,...);
8
9 int __wrap_printf(const char *format,...)
10 {
11 char* str_buffer;
12 // for(int i =0;i<512;i++)str_buffer[i]='\0';
13 int i;
14 va_list ap;
15 va_start(ap,format);
16 vasprintf(&str_buffer,format,ap);
17 va_end(ap);
18 i=strlen(str_buffer);
19 __opnfiles__[1]->ops->write(__opnfiles__[1],(void*)str_buffer,1,i);
20 }
21
22 extern int __real_puts(const char *s);
23
24 int __wrap_puts(const char *s)
25 {
26 int i;
27 i=strlen(s);
28 __opnfiles__[1]->ops->write(__opnfiles__[1],(void*)s,1,i);
29 }
2
30
3 int main(void)
31 int main(void)
4 {
32 {
5 bsp_init();
33 bsp_init();
6 libuc_main();
34 libuc_main();
7 }
35 }
@@ -1,7 +1,35
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <streamdevices.h>
1
4
5 extern streamdevice* __opnfiles__[];
6
7 extern int __real_printf(const char *format,...);
8
9 int __wrap_printf(const char *format,...)
10 {
11 char* str_buffer;
12 // for(int i =0;i<512;i++)str_buffer[i]='\0';
13 int i;
14 va_list ap;
15 va_start(ap,format);
16 vasprintf(&str_buffer,format,ap);
17 va_end(ap);
18 i=strlen(str_buffer);
19 __opnfiles__[1]->ops->write(__opnfiles__[1],(void*)str_buffer,1,i);
20 }
21
22 extern int __real_puts(const char *s);
23
24 int __wrap_puts(const char *s)
25 {
26 int i;
27 i=strlen(s);
28 __opnfiles__[1]->ops->write(__opnfiles__[1],(void*)s,1,i);
29 }
2
30
3 int main(void)
31 int main(void)
4 {
32 {
5 bsp_init();
33 bsp_init();
6 libuc_main();
34 libuc_main();
7 }
35 }
General Comments 0
You need to be logged in to leave comments. Login now