Code size
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
> gpioPinMap
this maps the IOpins to IO(0) to IO(24), pretty small at 96 bytes
> init_coridium
you need some form of this to configure hardware, probably not a lot
extra here
> memcpy
> memset
these copy or initialize memory, you might be able to remove them
> AD
does analog to digital conversion
> PULSIN
times a pulse on a pin
> COUNT
counts transitions on a pin over a period of time
> rand
generates a random number, unless you're using it, you can remove it
------------
I can't speak much to the innards of the floating point routines, I've
never looked at them, probably never will. For details you could look
at the source (install the full Winarm tool suite) or post a question
to the gnuarm group.
this maps the IOpins to IO(0) to IO(24), pretty small at 96 bytes
> init_coridium
you need some form of this to configure hardware, probably not a lot
extra here
> memcpy
> memset
these copy or initialize memory, you might be able to remove them
> AD
does analog to digital conversion
> PULSIN
times a pulse on a pin
> COUNT
counts transitions on a pin over a period of time
> rand
generates a random number, unless you're using it, you can remove it
------------
I can't speak much to the innards of the floating point routines, I've
never looked at them, probably never will. For details you could look
at the source (install the full Winarm tool suite) or post a question
to the gnuarm group.
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
I found that routine _gedf2 was being used in only one location. It was being
used where a Variable >= a decimal number. I changed the decimal number to
a float initialized to the decimal value. The routine _gedf2 is no longer used.
I didn't pick up much space, but there may be other instances, where there could
be savings.
--- On Sat, 2/14/09, basicnode <bruce@...> wrote:
From: basicnode <bruce@...>
Subject: [ARMexpress] Re: 38.24K Code on an ARMmite Board.
To: ARMexpress@yahoogroups.com
Date: Saturday, February 14, 2009, 12:24 AM
> gpioPinMap
this maps the IOpins to IO(0) to IO(24), pretty small at 96 bytes
> init_coridium
you need some form of this to configure hardware, probably not a lot
extra here
> memcpy
> memset
these copy or initialize memory, you might be able to remove them
> AD
does analog to digital conversion
> PULSIN
times a pulse on a pin
> COUNT
counts transitions on a pin over a period of time
> rand
generates a random number, unless you're using it, you can remove it
------------
I can't speak much to the innards of the floating point routines, I've
never looked at them, probably never will. For details you could look
at the source (install the full Winarm tool suite) or post a question
to the gnuarm group.
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
used where a Variable >= a decimal number. I changed the decimal number to
a float initialized to the decimal value. The routine _gedf2 is no longer used.
I didn't pick up much space, but there may be other instances, where there could
be savings.
--- On Sat, 2/14/09, basicnode <bruce@...> wrote:
From: basicnode <bruce@...>
Subject: [ARMexpress] Re: 38.24K Code on an ARMmite Board.
To: ARMexpress@yahoogroups.com
Date: Saturday, February 14, 2009, 12:24 AM
> gpioPinMap
this maps the IOpins to IO(0) to IO(24), pretty small at 96 bytes
> init_coridium
you need some form of this to configure hardware, probably not a lot
extra here
> memcpy
> memset
these copy or initialize memory, you might be able to remove them
> AD
does analog to digital conversion
> PULSIN
times a pulse on a pin
> COUNT
counts transitions on a pin over a period of time
> rand
generates a random number, unless you're using it, you can remove it
------------
I can't speak much to the innards of the floating point routines, I've
never looked at them, probably never will. For details you could look
at the source (install the full Winarm tool suite) or post a question
to the gnuarm group.
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
I have reduced the code to 32.25K. All my efforts to get less either
have no effect or increase the code size. It's time to stop spinning
wheels, and restore communication to the PC.
I'll restore the UART0 setup in cor_init.c.
Do I need 'printf'? Or is there a smaller alternative?
--- In ARMexpress@yahoogroups.com, "basicnode" <bruce@...> wrote:
>
> > I have my code down to 32.7K. I can download it to the ARMmite
board,
> > but I have no way to communicate with it. I have commented out all
> > the UART code. I need to restore one of the UARTs.
>
> They both use nearly identical code, though UART0 is normally used for
> communication back to the PC. If you only need them for output to the
> PC, then you can write directly to the UART TX register, which would
> save the interrupt code, and the buffered RX.
have no effect or increase the code size. It's time to stop spinning
wheels, and restore communication to the PC.
I'll restore the UART0 setup in cor_init.c.
Do I need 'printf'? Or is there a smaller alternative?
--- In ARMexpress@yahoogroups.com, "basicnode" <bruce@...> wrote:
>
> > I have my code down to 32.7K. I can download it to the ARMmite
board,
> > but I have no way to communicate with it. I have commented out all
> > the UART code. I need to restore one of the UARTs.
>
> They both use nearly identical code, though UART0 is normally used for
> communication back to the PC. If you only need them for output to the
> PC, then you can write directly to the UART TX register, which would
> save the interrupt code, and the buffered RX.
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
> I'll restore the UART0 setup in cor_init.c.
>
> Do I need 'printf'? Or is there a smaller alternative?
Before we switched to printf, we had a base set of routines for serial
IO, they are found in the distribution as cor_minio (as I remember it
was about 1/2 - 2/3 the size of printf).
Do you need 2 way communication with the PC? Or is it only posting
messages from the ARMmite to the PC
If its only one way, you could dispense with the interrupt for
receiving data, and just poll the status and send bytes out TX port.
This code would be much smaller than minio.
>
> Do I need 'printf'? Or is there a smaller alternative?
Before we switched to printf, we had a base set of routines for serial
IO, they are found in the distribution as cor_minio (as I remember it
was about 1/2 - 2/3 the size of printf).
Do you need 2 way communication with the PC? Or is it only posting
messages from the ARMmite to the PC
If its only one way, you could dispense with the interrupt for
receiving data, and just poll the status and send bytes out TX port.
This code would be much smaller than minio.
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
My immediate need is to sent messagsto the PC. I'll worrry about sending
commands from the PC at a later date and a future generation.
--- On Thu, 2/19/09, basicnode <bruce@...> wrote:
From: basicnode <bruce@...>
Subject: [ARMexpress] Re: 38.24K Code on an ARMmite Board.
To: ARMexpress@yahoogroups.com
Date: Thursday, February 19, 2009, 12:16 PM
> I'll restore the UART0 setup in cor_init.c.
>
> Do I need 'printf'? Or is there a smaller alternative?
Before we switched to printf, we had a base set of routines for serial
IO, they are found in the distribution as cor_minio (as I remember it
was about 1/2 - 2/3 the size of printf).
Do you need 2 way communication with the PC? Or is it only posting
messages from the ARMmite to the PC
If its only one way, you could dispense with the interrupt for
receiving data, and just poll the status and send bytes out TX port.
This code would be much smaller than minio.
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
commands from the PC at a later date and a future generation.
--- On Thu, 2/19/09, basicnode <bruce@...> wrote:
From: basicnode <bruce@...>
Subject: [ARMexpress] Re: 38.24K Code on an ARMmite Board.
To: ARMexpress@yahoogroups.com
Date: Thursday, February 19, 2009, 12:16 PM
> I'll restore the UART0 setup in cor_init.c.
>
> Do I need 'printf'? Or is there a smaller alternative?
Before we switched to printf, we had a base set of routines for serial
IO, they are found in the distribution as cor_minio (as I remember it
was about 1/2 - 2/3 the size of printf).
Do you need 2 way communication with the PC? Or is it only posting
messages from the ARMmite to the PC
If its only one way, you could dispense with the interrupt for
receiving data, and just poll the status and send bytes out TX port.
This code would be much smaller than minio.
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
> My immediate need is to sent messagsto the PC. I'll worrry about
>sending commands from the PC at a later date and a future generation.
cor_min_io has some print hex/decimal number routines
from cor_init
condensed output only routine
int uart0TXFIFOcnt;
putchar(char ch) {
if (UART0_LSR & ULSR_TEMT) uart0TXFIFOcnt = 16;
if (uart0TXFIFOcnt == 0) { // no way to know how full this
FIFO is
while ((UART0_LSR & ULSR_TEMT) == 0);
uart0TXFIFOcnt = 16;
}
UART0_THR = (char)ch;
uart0TXFIFOcnt--;
}
--------------
or ignore the FIFO and just look at (UART0_LSR & ULSR_TEMT)
>sending commands from the PC at a later date and a future generation.
cor_min_io has some print hex/decimal number routines
from cor_init
condensed output only routine
int uart0TXFIFOcnt;
putchar(char ch) {
if (UART0_LSR & ULSR_TEMT) uart0TXFIFOcnt = 16;
if (uart0TXFIFOcnt == 0) { // no way to know how full this
FIFO is
while ((UART0_LSR & ULSR_TEMT) == 0);
uart0TXFIFOcnt = 16;
}
UART0_THR = (char)ch;
uart0TXFIFOcnt--;
}
--------------
or ignore the FIFO and just look at (UART0_LSR & ULSR_TEMT)
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
I have an array named 'string'. I am trying to send it to the
terminal using the following code.
uart0Puts(string);
In cor_init.c I have this procedure:
void uart0Puts(char *string)
{
void uart0putchar(char ch) {
int uart0TXFIFOcnt = 0;
if (UART0_LSR & ULSR_TEMT) uart0TXFIFOcnt = 16;
if (uart0TXFIFOcnt == 0) { // no way to know how full this
FIFO is
while ((UART0_LSR & ULSR_TEMT) == 0);
uart0TXFIFOcnt = 16;
}
UART0_THR = (char)ch;
uart0TXFIFOcnt--;
}
char ch;
while ((ch = *string++) != 0) {
uart0putchar(ch);
}
}
I don't get anything from the TlcTerm program. What am I doing wrong?
terminal using the following code.
uart0Puts(string);
In cor_init.c I have this procedure:
void uart0Puts(char *string)
{
void uart0putchar(char ch) {
int uart0TXFIFOcnt = 0;
if (UART0_LSR & ULSR_TEMT) uart0TXFIFOcnt = 16;
if (uart0TXFIFOcnt == 0) { // no way to know how full this
FIFO is
while ((UART0_LSR & ULSR_TEMT) == 0);
uart0TXFIFOcnt = 16;
}
UART0_THR = (char)ch;
uart0TXFIFOcnt--;
}
char ch;
while ((ch = *string++) != 0) {
uart0putchar(ch);
}
}
I don't get anything from the TlcTerm program. What am I doing wrong?
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
> I don't get anything from the TlcTerm program. What am I doing wrong?
>
You must have mis-cut and paste here, as that code would not compile.
C does not have scoped functions, (functions defined inside other
functions).
In any case, the FIFO counter needs to be a global variable.
To get things going, ignore the FIFO, and just wait for the TX buffer
to be empty.
>
You must have mis-cut and paste here, as that code would not compile.
C does not have scoped functions, (functions defined inside other
functions).
In any case, the FIFO counter needs to be a global variable.
To get things going, ignore the FIFO, and just wait for the TX buffer
to be empty.
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
Still no data on TlcTerm. I have simplified the code as follows:
char ch = ((char)"W");
void uart0putchar(char ch) {
if (UART0_LSR & ULSR_TEMT)
UART0_THR = (char)ch;
uart0putchar(ch);
char ch = ((char)"W");
void uart0putchar(char ch) {
if (UART0_LSR & ULSR_TEMT)
UART0_THR = (char)ch;
uart0putchar(ch);
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Code size
I can't find a definition for ULSR_TEMT in LPC210x.h