Libmc1322x developers guide

Mariano Alvira edited this page Dec 2, 2013 · 3 revisions

Development to reduce RAM usage

Here is some ram usage information from the nvm_read program:

12272 nvm_read
10224 nvm_read without rom calls (2048 bytes)
8060  nmv_read without printf (2164)
3036  without uart_init (and all the uart related buffers etc.) (5024 bytes)

Eliminating or minimizing ROM_VARS space

There is currently a 1.7kB space reserved for the rom_vars. This area of RAM is allowed to be used by the various routines in the ROM. The space is reserved in the start.S:

.org 0x120
ROM_var_start: .word 0
.org 0x7ff
ROM_var_end: .word 0
#endif /*USE_ROM_VARS*/

Currently, the only critical functions performed by ROM calls are the nvm_* routines and there isn't a particular reason why these have to be ROM calls. get_lqi in maca.c is also a ROM call.

There are two approaches here:

  • Isolate the RAM locations necessary for the ROM calls used and only reserve them.
  • Re-implement the rom calls.

Neither option is particularly difficult. The largest RAM gains would probably come from isolating the rom_vars currently used (unless the ROM code is doing something bad like allocating big buffers).

Upgrading to the latest GCC

####Compiler link

####From Tyler:

I think it works just fine.  Download the latest code sorcery compiler... turn off all the 'interworking'
 stuff in the makefile (interworking is default now)... leave the '-mthumb' thingy (ROM calls are thumb I 
guess)... and apply the 'Mar Fix' to start.S (to get into Thumb) and you are all set.

I have only experimented on an econotag.  I wrote a program (a libmc1322x test program) to play with the 
nvm_* routines.  I was able to detect/read/write/erase nvm.  I was able to get rftest-rx/tx to talk to one 
another.  Also, I was able to compile the backpack code and get it to boot up on an econotag.  I just 
haven't run anything on my own hardware.

####The "mar fix" to start.S:

The jump to main in start.S needs to become:

        ldr ip, main_addr
        bx ip

        .word main

Not sure if this code will still work on the old compiler (but I think it will).

There are various places where there are unused variables (e.g. i2c and maca). These need:


Then pwm.c has an error with the assembly unless the following is used:

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.