add romimg
This commit is contained in:
parent
6309b16235
commit
383a965c21
|
@ -6,7 +6,7 @@ MC1322X := ..
|
|||
COBJS := tests.o put.o
|
||||
|
||||
# all of the target programs to build
|
||||
TARGETS := blink-red blink-green blink-blue blink-white blink-allio uart1-loopback nvm-read nvm-write
|
||||
TARGETS := blink-red blink-green blink-blue blink-white blink-allio uart1-loopback nvm-read nvm-write romimg
|
||||
|
||||
include $(MC1322X)/Makefile.include
|
||||
|
||||
|
|
|
@ -2,66 +2,17 @@
|
|||
#include <board.h>
|
||||
|
||||
#include "tests.h"
|
||||
#include "put.h"
|
||||
|
||||
/* INC = 767; MOD = 9999 works: 115200 @ 24 MHz 16 bit sample */
|
||||
#define INC 767
|
||||
#define MOD 9999
|
||||
|
||||
void putc(uint8_t c);
|
||||
void puts(uint8_t *s);
|
||||
void put_hex(uint8_t x);
|
||||
void put_hex16(uint16_t x);
|
||||
void put_hex32(uint32_t x);
|
||||
|
||||
const uint8_t hex[16]={'0','1','2','3','4','5','6','7',
|
||||
'8','9','a','b','c','d','e','f'};
|
||||
|
||||
#define DUMP_BASE 0x00000000
|
||||
#define DUMP_LEN 0x00014000
|
||||
//#define DUMP_LEN 16
|
||||
#include "config.h"
|
||||
|
||||
void main(void) {
|
||||
volatile uint32_t i;
|
||||
volatile uint8_t *data;
|
||||
|
||||
uart_init(inc, mod);
|
||||
uart_init(INC, MOD);
|
||||
|
||||
for(data=DUMP_BASE; data<(DUMP_BASE+DUMP_LEN); data++) {
|
||||
for(data = DUMP_BASE; data < ((uint8_t *)(DUMP_BASE+DUMP_LEN)); data++) {
|
||||
putc(*data);
|
||||
}
|
||||
|
||||
while(1);
|
||||
|
||||
}
|
||||
|
||||
void putc(uint8_t c) {
|
||||
while(reg(UT1CON)==31); /* wait for there to be room in the buffer */
|
||||
reg(UART1_DATA) = c;
|
||||
}
|
||||
|
||||
void puts(uint8_t *s) {
|
||||
while(s && *s!=0) {
|
||||
putc(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void put_hex(uint8_t x)
|
||||
{
|
||||
putc(hex[x >> 4]);
|
||||
putc(hex[x & 15]);
|
||||
}
|
||||
|
||||
void put_hex16(uint16_t x)
|
||||
{
|
||||
put_hex((x >> 8) & 0xFF);
|
||||
put_hex((x) & 0xFF);
|
||||
}
|
||||
|
||||
void put_hex32(uint32_t x)
|
||||
{
|
||||
put_hex((x >> 24) & 0xFF);
|
||||
put_hex((x >> 16) & 0xFF);
|
||||
put_hex((x >> 8) & 0xFF);
|
||||
put_hex((x) & 0xFF);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue