Hi,
Alan Carvalho de Assis and me have been working on making nuttx-bb work on our phones( I've a gta02 and he has a Motorola W220) and here are the patches(against nuttx-bb).
To try it, clone nuttx-bb and osmocom-bb, put it in the same directory and keep the name of the osmocom-bb directory. Then put the gnuarm(for 64bit) or the codesourcery(for 32bit) in your path(there is a problem with gnuarm for 32bit). Compile osmocom-bb as usual(cd osmocom-bb/src && make). Then go in nuttx-bb directory and do: cd nuttx/tools/ ./configure.sh compal_e88/nsh #for for compal_e88( gta02 and Motorola W220). ./configure.sh compal_e99/nsh #we need testers for compal_e99, we don't have one. cd ../ make
That will create a nuttx.bin, load it as usual(like any other firmware for your calypso). Then the following will appear: Finished, sent 63 blocks in total Received block ack from phone Sending checksum: 0x66 Checksum on phone side matches, let's branch to your code Branching to 0x00820000 Received branch ack, your code is running now!
NuttShell (NSH)
To send commands to the shell you need to run loadwriter.py that is included in the source code at: nuttx/drivers/sercomm/loadwriter.py
The list of commands can be found by typing help.
Denis.
From: Alan Carvalho de Assis acassis@gmail.com
We cannot send a big chunk of bytes to sercomm_puts because .txready on NuttX doesn't detect when "UART" finished sending data, then data are lost. An work-around to fix it is sending less bytes and putting a delay after each transfer.
Signed-off-by: Alan Carvalho de Assis acassis@gmail.com --- nuttx/drivers/sercomm/console.c | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/nuttx/drivers/sercomm/console.c b/nuttx/drivers/sercomm/console.c index 09ce469..1b96acf 100644 --- a/nuttx/drivers/sercomm/console.c +++ b/nuttx/drivers/sercomm/console.c @@ -106,14 +106,27 @@ static ssize_t sc_console_read(file_t *filep, FAR char *buffer, size_t buflen) }
/* XXX: redirect to old Osmocom-BB comm/sercomm_cons.c -> 2 buffers */ -extern int sercomm_write(void *file, const char *s, const int len); +extern int sercomm_puts(const char *s); static ssize_t sc_console_write(file_t *filep, FAR const char *buffer, size_t buflen) { - int ret = sercomm_write(filep, buffer, buflen); - if(ret < 0) - return ret; + int i, cnt; + char dstbuf[32]; + + if (buflen >= 31) + cnt = 31; else - return buflen; + cnt = buflen; + + memcpy(dstbuf, buffer, cnt); + dstbuf[cnt] = '\0'; + + /* print part of our buffer */ + sercomm_puts(dstbuf); + + /* wait a little bit to get data transfered */ + up_mdelay(1); + + return cnt; }
/* Forward ioctl to uart driver */
On 2/25/12, Denis 'GNUtoo' Carikli GNUtoo@no-log.org wrote: snip
- if (buflen >= 31)
elsecnt = 31;
return buflen;
cnt = buflen;
I could simplify this if/else by:
cnt = buflen & 0x1F;
but I think it will not be readable for other people.
Best Regards,
Alan
if (buflen >= 31)
cnt = 31; else
return buflen;
cnt = buflen;
I could simplify this if/else by:
cnt = buflen & 0x1F;
but I think it will not be readable for other people.
It would also be wrong ...
32 & 0x1F = 0 ...
Cheers,
Sylvain
On 2/25/12, Sylvain Munaut 246tnt@gmail.com wrote:
cnt = buflen & 0x1F;
but I think it will not be readable for other people.
It would also be wrong ...
32 & 0x1F = 0 ...
Yes, my fault, it should saturate on 31 if buflen bigger than 31.
So, let us keep this if/else.
BR,
Alan
The compal_e88 directory contains a fixed linking script to make it work romloader compatibles phones.
Signed-off-by: Denis 'GNUtoo' Carikli GNUtoo@no-log.org --- .../calypsotest/Make.defs | 2 +- .../calypsotest/appconfig | 0 .../calypsotest/defconfig | 6 +++--- .../ostest => compal_e88/calypsotest}/setenv.sh | 0 .../{compal_e99 => compal_e88}/include/board.h | 0 nuttx/configs/{compal_e99 => compal_e88}/ld.script | 20 +++++++++++--------- .../{compal_e99 => compal_e88}/nsh/Make.defs | 0 .../{compal_e99 => compal_e88}/nsh/appconfig | 0 .../{compal_e99 => compal_e88}/nsh/defconfig | 4 ++-- .../{compal_e99 => compal_e88/nsh}/ld.script | 20 +++++++++++--------- .../configs/{c5471evm => compal_e88}/nsh/setenv.sh | 0 .../{compal_e99 => compal_e88}/ostest/Make.defs | 2 +- .../{c5471evm => compal_e88}/ostest/appconfig | 0 .../{compal_e99 => compal_e88}/ostest/defconfig | 6 +++--- .../{c5471evm => compal_e88}/ostest/setenv.sh | 0 nuttx/configs/compal_e88/src/Make.dep | 1 + .../{compal_e99 => compal_e88}/src/Makefile | 2 +- .../configs/{compal_e99 => compal_e88}/src/dummy.c | 0 18 files changed, 34 insertions(+), 29 deletions(-) copy nuttx/configs/{compal_e99 => compal_e88}/calypsotest/Make.defs (99%) copy nuttx/configs/{compal_e99 => compal_e88}/calypsotest/appconfig (100%) copy nuttx/configs/{compal_e99 => compal_e88}/calypsotest/defconfig (99%) copy nuttx/configs/{c5471evm/ostest => compal_e88/calypsotest}/setenv.sh (100%) copy nuttx/configs/{compal_e99 => compal_e88}/include/board.h (100%) copy nuttx/configs/{compal_e99 => compal_e88}/ld.script (91%) copy nuttx/configs/{compal_e99 => compal_e88}/nsh/Make.defs (100%) copy nuttx/configs/{compal_e99 => compal_e88}/nsh/appconfig (100%) copy nuttx/configs/{compal_e99 => compal_e88}/nsh/defconfig (99%) copy nuttx/configs/{compal_e99 => compal_e88/nsh}/ld.script (91%) copy nuttx/configs/{c5471evm => compal_e88}/nsh/setenv.sh (100%) copy nuttx/configs/{compal_e99 => compal_e88}/ostest/Make.defs (99%) copy nuttx/configs/{c5471evm => compal_e88}/ostest/appconfig (100%) copy nuttx/configs/{compal_e99 => compal_e88}/ostest/defconfig (99%) copy nuttx/configs/{c5471evm => compal_e88}/ostest/setenv.sh (100%) create mode 100644 nuttx/configs/compal_e88/src/.depend create mode 100644 nuttx/configs/compal_e88/src/Make.dep copy nuttx/configs/{compal_e99 => compal_e88}/src/Makefile (98%) copy nuttx/configs/{compal_e99 => compal_e88}/src/dummy.c (100%)
diff --git a/nuttx/configs/compal_e99/calypsotest/Make.defs b/nuttx/configs/compal_e88/calypsotest/Make.defs similarity index 99% copy from nuttx/configs/compal_e99/calypsotest/Make.defs copy to nuttx/configs/compal_e88/calypsotest/Make.defs index 405dbd2..4099ccd 100644 --- a/nuttx/configs/compal_e99/calypsotest/Make.defs +++ b/nuttx/configs/compal_e88/calypsotest/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# configs/compal_e99/ostest/Make.defs +# configs/compal_e88/ostest/Make.defs # # Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt spudmonkey@racsa.co.cr diff --git a/nuttx/configs/compal_e99/calypsotest/appconfig b/nuttx/configs/compal_e88/calypsotest/appconfig similarity index 100% copy from nuttx/configs/compal_e99/calypsotest/appconfig copy to nuttx/configs/compal_e88/calypsotest/appconfig diff --git a/nuttx/configs/compal_e99/calypsotest/defconfig b/nuttx/configs/compal_e88/calypsotest/defconfig similarity index 99% copy from nuttx/configs/compal_e99/calypsotest/defconfig copy to nuttx/configs/compal_e88/calypsotest/defconfig index e30ae36..8ac4bb6 100644 --- a/nuttx/configs/compal_e99/calypsotest/defconfig +++ b/nuttx/configs/compal_e88/calypsotest/defconfig @@ -1,5 +1,5 @@ ############################################################################ -# configs/compal_e99/ostest/defconfig +# configs/compal_e88/ostest/defconfig # # Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt spudmonkey@racsa.co.cr @@ -64,8 +64,8 @@ CONFIG_ARCH_ARM=y CONFIG_ARCH_ARM7TDMI=y CONFIG_ARCH_CHIP=calypso CONFIG_ARCH_CHIP_CALYPSO=y -CONFIG_ARCH_BOARD=compal_e99 -CONFIG_ARCH_BOARD_COMPALE99=y +CONFIG_ARCH_BOARD=compal_e88 +CONFIG_ARCH_BOARD_COMPALE88=y CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_ROM_VECTORS=n CONFIG_DRAM_END=0x00840000 diff --git a/nuttx/configs/c5471evm/ostest/setenv.sh b/nuttx/configs/compal_e88/calypsotest/setenv.sh similarity index 100% copy from nuttx/configs/c5471evm/ostest/setenv.sh copy to nuttx/configs/compal_e88/calypsotest/setenv.sh diff --git a/nuttx/configs/compal_e99/include/board.h b/nuttx/configs/compal_e88/include/board.h similarity index 100% copy from nuttx/configs/compal_e99/include/board.h copy to nuttx/configs/compal_e88/include/board.h diff --git a/nuttx/configs/compal_e99/ld.script b/nuttx/configs/compal_e88/ld.script similarity index 91% copy from nuttx/configs/compal_e99/ld.script copy to nuttx/configs/compal_e88/ld.script index 07f1ab0..838aad2 100644 --- a/nuttx/configs/compal_e99/ld.script +++ b/nuttx/configs/compal_e88/ld.script @@ -11,10 +11,12 @@ OUTPUT_ARCH(arm) ENTRY(__start) MEMORY { + /* 0x800000-0x83ffff */ /* compal-loaded binary: our text, initialized data */ - LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00010000 + LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00020000 + TRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x00010000 /* compal-loaded binary: our unitialized data, stacks, heap */ - IRAM (rw) : ORIGIN = 0x00810000, LENGTH = 0x00010000 + IRAM (rw) : ORIGIN = 0x00830000, LENGTH = 0x0000ffff } SECTIONS { @@ -32,7 +34,7 @@ SECTIONS PROVIDE(__start = .); KEEP(*(.text.start)) *(.text.start) - } > LRAM + } > TRAM
/* exception vectors from 0x80001c to 0x800034 */ .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) { @@ -53,7 +55,7 @@ SECTIONS /* gcc voodoo */ *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) . = ALIGN(4); - } > LRAM + } > TRAM PROVIDE(_text_start = LOADADDR(.text)); PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text));
@@ -65,7 +67,7 @@ SECTIONS KEEP(*(SORT(.ctors))) /* end of list */ LONG(0) - } > LRAM + } > TRAM PROVIDE(_ctor_start = LOADADDR(.ctors)); PROVIDE(_ctor_end = LOADADDR(.ctors) + SIZEOF(.ctors));
@@ -77,7 +79,7 @@ SECTIONS KEEP(*(SORT(.dtors))) /* end of list */ LONG(0) - } > LRAM + } > TRAM PROVIDE(_dtor_start = LOADADDR(.dtors)); PROVIDE(_dtor_end = LOADADDR(.dtors) + SIZEOF(.dtors));
@@ -85,7 +87,7 @@ SECTIONS . = ALIGN(4); .rodata : { *(.rodata*) - } > LRAM + } > TRAM PROVIDE(_rodata_start = LOADADDR(.rodata)); PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata));
@@ -93,7 +95,7 @@ SECTIONS . = ALIGN(4); .data : { *(.data) - } > LRAM + } > TRAM PROVIDE(_data_start = LOADADDR(.data)); PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data));
@@ -102,7 +104,7 @@ SECTIONS .got : { *(.got) *(.got.plt) *(.igot.plt) *(.got) *(.igot) - } > LRAM + } > TRAM PROVIDE(_got_start = LOADADDR(.got)); PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got));
diff --git a/nuttx/configs/compal_e99/nsh/Make.defs b/nuttx/configs/compal_e88/nsh/Make.defs similarity index 100% copy from nuttx/configs/compal_e99/nsh/Make.defs copy to nuttx/configs/compal_e88/nsh/Make.defs diff --git a/nuttx/configs/compal_e99/nsh/appconfig b/nuttx/configs/compal_e88/nsh/appconfig similarity index 100% copy from nuttx/configs/compal_e99/nsh/appconfig copy to nuttx/configs/compal_e88/nsh/appconfig diff --git a/nuttx/configs/compal_e99/nsh/defconfig b/nuttx/configs/compal_e88/nsh/defconfig similarity index 99% copy from nuttx/configs/compal_e99/nsh/defconfig copy to nuttx/configs/compal_e88/nsh/defconfig index 946c9cf..ebec6f0 100644 --- a/nuttx/configs/compal_e99/nsh/defconfig +++ b/nuttx/configs/compal_e88/nsh/defconfig @@ -64,8 +64,8 @@ CONFIG_ARCH_ARM=y CONFIG_ARCH_ARM7TDMI=y CONFIG_ARCH_CHIP=calypso CONFIG_ARCH_CHIP_CALYPSO=y -CONFIG_ARCH_BOARD=compal_e99 -CONFIG_ARCH_BOARD_COMPALE99=y +CONFIG_ARCH_BOARD=compal_e88 +CONFIG_ARCH_BOARD_COMPALE88=y CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_ROM_VECTORS=n CONFIG_DRAM_END=0x00840000 diff --git a/nuttx/configs/compal_e99/ld.script b/nuttx/configs/compal_e88/nsh/ld.script similarity index 91% copy from nuttx/configs/compal_e99/ld.script copy to nuttx/configs/compal_e88/nsh/ld.script index 07f1ab0..838aad2 100644 --- a/nuttx/configs/compal_e99/ld.script +++ b/nuttx/configs/compal_e88/nsh/ld.script @@ -11,10 +11,12 @@ OUTPUT_ARCH(arm) ENTRY(__start) MEMORY { + /* 0x800000-0x83ffff */ /* compal-loaded binary: our text, initialized data */ - LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00010000 + LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00020000 + TRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x00010000 /* compal-loaded binary: our unitialized data, stacks, heap */ - IRAM (rw) : ORIGIN = 0x00810000, LENGTH = 0x00010000 + IRAM (rw) : ORIGIN = 0x00830000, LENGTH = 0x0000ffff } SECTIONS { @@ -32,7 +34,7 @@ SECTIONS PROVIDE(__start = .); KEEP(*(.text.start)) *(.text.start) - } > LRAM + } > TRAM
/* exception vectors from 0x80001c to 0x800034 */ .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) { @@ -53,7 +55,7 @@ SECTIONS /* gcc voodoo */ *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) . = ALIGN(4); - } > LRAM + } > TRAM PROVIDE(_text_start = LOADADDR(.text)); PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text));
@@ -65,7 +67,7 @@ SECTIONS KEEP(*(SORT(.ctors))) /* end of list */ LONG(0) - } > LRAM + } > TRAM PROVIDE(_ctor_start = LOADADDR(.ctors)); PROVIDE(_ctor_end = LOADADDR(.ctors) + SIZEOF(.ctors));
@@ -77,7 +79,7 @@ SECTIONS KEEP(*(SORT(.dtors))) /* end of list */ LONG(0) - } > LRAM + } > TRAM PROVIDE(_dtor_start = LOADADDR(.dtors)); PROVIDE(_dtor_end = LOADADDR(.dtors) + SIZEOF(.dtors));
@@ -85,7 +87,7 @@ SECTIONS . = ALIGN(4); .rodata : { *(.rodata*) - } > LRAM + } > TRAM PROVIDE(_rodata_start = LOADADDR(.rodata)); PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata));
@@ -93,7 +95,7 @@ SECTIONS . = ALIGN(4); .data : { *(.data) - } > LRAM + } > TRAM PROVIDE(_data_start = LOADADDR(.data)); PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data));
@@ -102,7 +104,7 @@ SECTIONS .got : { *(.got) *(.got.plt) *(.igot.plt) *(.got) *(.igot) - } > LRAM + } > TRAM PROVIDE(_got_start = LOADADDR(.got)); PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got));
diff --git a/nuttx/configs/c5471evm/nsh/setenv.sh b/nuttx/configs/compal_e88/nsh/setenv.sh similarity index 100% copy from nuttx/configs/c5471evm/nsh/setenv.sh copy to nuttx/configs/compal_e88/nsh/setenv.sh diff --git a/nuttx/configs/compal_e99/ostest/Make.defs b/nuttx/configs/compal_e88/ostest/Make.defs similarity index 99% copy from nuttx/configs/compal_e99/ostest/Make.defs copy to nuttx/configs/compal_e88/ostest/Make.defs index 06ef3d4..c887dd0 100644 --- a/nuttx/configs/compal_e99/ostest/Make.defs +++ b/nuttx/configs/compal_e88/ostest/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# configs/compal_e99/ostest/Make.defs +# configs/compal_e88/ostest/Make.defs # # Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt spudmonkey@racsa.co.cr diff --git a/nuttx/configs/c5471evm/ostest/appconfig b/nuttx/configs/compal_e88/ostest/appconfig similarity index 100% copy from nuttx/configs/c5471evm/ostest/appconfig copy to nuttx/configs/compal_e88/ostest/appconfig diff --git a/nuttx/configs/compal_e99/ostest/defconfig b/nuttx/configs/compal_e88/ostest/defconfig similarity index 99% copy from nuttx/configs/compal_e99/ostest/defconfig copy to nuttx/configs/compal_e88/ostest/defconfig index 12c365e..1b5ded9 100644 --- a/nuttx/configs/compal_e99/ostest/defconfig +++ b/nuttx/configs/compal_e88/ostest/defconfig @@ -1,5 +1,5 @@ ############################################################################ -# configs/compal_e99/ostest/defconfig +# configs/compal_e88/ostest/defconfig # # Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt spudmonkey@racsa.co.cr @@ -64,8 +64,8 @@ CONFIG_ARCH_ARM=y CONFIG_ARCH_ARM7TDMI=y CONFIG_ARCH_CHIP=calypso CONFIG_ARCH_CHIP_CALYPSO=y -CONFIG_ARCH_BOARD=compal_e99 -CONFIG_ARCH_BOARD_COMPALE99=y +CONFIG_ARCH_BOARD=compal_e88 +CONFIG_ARCH_BOARD_COMPALE88=y CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_ROM_VECTORS=n CONFIG_DRAM_END=0x00840000 diff --git a/nuttx/configs/c5471evm/ostest/setenv.sh b/nuttx/configs/compal_e88/ostest/setenv.sh similarity index 100% copy from nuttx/configs/c5471evm/ostest/setenv.sh copy to nuttx/configs/compal_e88/ostest/setenv.sh diff --git a/nuttx/configs/compal_e88/src/.depend b/nuttx/configs/compal_e88/src/.depend new file mode 100644 index 0000000..e69de29 diff --git a/nuttx/configs/compal_e88/src/Make.dep b/nuttx/configs/compal_e88/src/Make.dep new file mode 100644 index 0000000..b8378cf --- /dev/null +++ b/nuttx/configs/compal_e88/src/Make.dep @@ -0,0 +1 @@ +dummy.o: dummy.c diff --git a/nuttx/configs/compal_e99/src/Makefile b/nuttx/configs/compal_e88/src/Makefile similarity index 98% copy from nuttx/configs/compal_e99/src/Makefile copy to nuttx/configs/compal_e88/src/Makefile index 2160ea3..851a603 100644 --- a/nuttx/configs/compal_e99/src/Makefile +++ b/nuttx/configs/compal_e88/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# configs/compal_e99/src/Makefile +# configs/compal_e88/src/Makefile # # Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. # Author: Gregory Nutt spudmonkey@racsa.co.cr diff --git a/nuttx/configs/compal_e99/src/dummy.c b/nuttx/configs/compal_e88/src/dummy.c similarity index 100% copy from nuttx/configs/compal_e99/src/dummy.c copy to nuttx/configs/compal_e88/src/dummy.c
Without that fix some compal_e88 phones like the Motorola W220 don't print the "NuttShell (NSH)" initial message.
Signed-off-by: Denis 'GNUtoo' Carikli GNUtoo@no-log.org --- nuttx/arch/arm/src/calypso/calypso_heap.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/nuttx/arch/arm/src/calypso/calypso_heap.c b/nuttx/arch/arm/src/calypso/calypso_heap.c index d35a76f..7ae0490 100644 --- a/nuttx/arch/arm/src/calypso/calypso_heap.c +++ b/nuttx/arch/arm/src/calypso/calypso_heap.c @@ -60,9 +60,11 @@
void up_addregion(void) { +#ifdef CONFIG_ARCH_BOARD_COMPALE99 /* Disable watchdog in first non-common function */ wdog_enable(0); - +#endif + // XXX: change to initialization of extern memory with save defaults /* Configure memory interface */ calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
Hi Denis,
thansk a lot for your work on the nuttx-bb code base. As there isn't really any other activity in the repository, I'm happy to give you direct git write access. If you'd like that, please send me a SSHv2 public key.
On Sat, Feb 25, 2012 at 09:34:40PM +0100, Denis 'GNUtoo' Carikli wrote:
./configure.sh compal_e99/nsh #we need testers for compal_e99, we don't have one.
If you'd like to test E99, I can send you guys one or two new C155 for free.
Just let me know the shipping address in private mail.
Regards, Harald
baseband-devel@lists.osmocom.org