[Milkymist-devel] fix broken compile & minor development for milkymist bios
Clark Xin
codinflu at gmail.com
Sun Aug 2 12:25:41 PDT 2009
Hi all,
Here are some changes that I made in my snapshot, it is for your
information.
I wasnt able to build bios.bin in my system
log was:
==========================================
../../software/lib/baselib-light.a(libc.o): In function `sprintf':
libc.c:(.text+0x914): undefined reference to `__builtin_stdarg_start'
../../software/lib/baselib-light.a(libc.o): In function `scnprintf':
libc.c:(.text+0x990): undefined reference to `__builtin_stdarg_start'
../../software/lib/baselib-light.a(libc.o): In function `snprintf':
libc.c:(.text+0xa14): undefined reference to `__builtin_stdarg_start'
../../software/lib/baselib-light.a(console.o): In function `printf':
console.c:(.text+0x274): undefined reference to `__builtin_stdarg_start'
make: *** [bios.elf] Error 1
==========================================
Another patch is for character view of memory when using mr command.
I am using it for some debug purposes. like, viewing stack area or
a character array after a kernel crash.
BIOS> mr 0x4026f968 100
0x4026f968 98 00 04 48 98 00 04 58 98 00 04 68 98 00 04 78
...H...X...h...x
0x4026f978 98 00 04 88 98 00 04 98 98 00 04 a8 98 00 04 b8
................
0x4026f988 98 00 04 c8 98 00 04 d8 98 00 04 e8 98 00 04 f8
................
0x4026f998 98 00 05 08 98 00 05 18 98 00 05 28 98 00 05 38
...........(...8
0x4026f9a8 98 00 05 48 98 00 05 58 98 00 05 68 98 00 05 78
...H...X...h...x
0x4026f9b8 98 00 05 88 98 00 05 98 98 00 05 a8 98 00 05 b8
................
0x4026f9c8 98 00 05 c8
....
BIOS>
--
Regards
Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.milkymist.org/pipermail/devel-milkymist.org/attachments/20090802/2a1f9c12/attachment.htm>
-------------- next part --------------
--- milkymist-core/software/include/libc.h 2009-05-14 17:02:47.000000000 +0300
+++ milkymist-core/software/include/libc.h 2009-08-02 18:46:30.000000000 +0300
@@ -3,8 +3,11 @@
#ifndef __LIBC_H
#define __LIBC_H
-#define va_start(ap, last) \
- __builtin_stdarg_start((ap), (last))
+#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))
+#define va_start(v,l)__builtin_va_start((v),l)
+#else
+#define va_start(v,l)__builtin_stdarg_start((v),l)
+#endif
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
-------------- next part --------------
--- bios/main.c 2009-08-02 18:48:04.000000000 +0300
+++ bios/main.c 2009-08-02 20:25:14.000000000 +0300
@@ -205,21 +205,45 @@
/* General address space functions */
+#define NUMBER_OF_BYTES_ON_A_LINE 16
static void dump_4bytes(unsigned int *ptr, int count, unsigned addr)
{
- int i;
+ char *data = (char *)ptr;
+ int line_bytes = 0, i = 0;
- putsnonl("Memory dump:");
- for (i=0;i<count;i++) {
- if (!(i&3)) {
- printf("\n%08x:", addr);
- addr += 16;
- }
- printf(" %08x", *ptr++);
+ while(count > 0){
+ line_bytes =
+ (count > NUMBER_OF_BYTES_ON_A_LINE)?NUMBER_OF_BYTES_ON_A_LINE:count;
+
+ printf("\n 0x%08x ", addr);
+ for(i = 0; i < line_bytes; i++ ){
+ printf("%02x ", *(unsigned char*)(data+i));
}
- putsnonl("\n");
+
+ if (line_bytes < NUMBER_OF_BYTES_ON_A_LINE)
+ for(i = 0; i < (NUMBER_OF_BYTES_ON_A_LINE-line_bytes); i++)
+ printf(" ");
+
+ printf(" ");
+ for(i = 0; i < line_bytes; i++){
+ if ((*(data+i) < 0x20) || (*(data+i) > 0x7e))
+ printf(".");
+ else
+ printf("%c", *(data+i));
+ }
+ if (line_bytes < NUMBER_OF_BYTES_ON_A_LINE)
+ for(i=0;i < (NUMBER_OF_BYTES_ON_A_LINE - line_bytes); i++)
+ printf(" ");
+
+ data += (char)line_bytes;
+ count -= line_bytes;
+ addr += line_bytes;
+ }
+ printf("\n");
+
}
+
static void mr(char *startaddr, char *len)
{
char *c;
More information about the Devel
mailing list