URL
https://opencores.org/ocsvn/openmsp430/openmsp430/trunk
Subversion Repositories openmsp430
Compare Revisions
- This comparison shows the changes necessary to convert path
/openmsp430/trunk/core/sim
- from Rev 207 to Rev 211
- ↔ Reverse comparison
Rev 207 → Rev 211
/rtl_sim/src-c/dhrystone_v2.1/copydata.c
File deleted
/rtl_sim/src-c/dhrystone_v2.1/omsp_func.h
40,7 → 40,8
//---------------------------------------------------------- |
// SPECIAL FUNCTION REGISTERS |
//---------------------------------------------------------- |
#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IE1_set_wdtie() __asm__ __volatile__ ("bis.b #0x01, &0x0000") |
//#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IFG1 (*(volatile unsigned char *) 0x0002) |
|
#define CPU_ID_LO (*(volatile unsigned char *) 0x0004) |
121,4 → 122,6
// FUNCTIONS |
//============================================================================= |
|
//int putchar (int txdata); |
// Replace printf statements with custom one |
#include "mylib/cprintf.h" |
#define printf cprintf |
/rtl_sim/src-c/dhrystone_v2.1/linker.msp430-elf.x
237,7 → 237,7
/* DWARF 2 */ |
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
.debug_abbrev 0 : { *(.debug_abbrev) } |
.debug_line 0 : { *(.debug_line) } |
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } |
.debug_frame 0 : { *(.debug_frame) } |
.debug_str 0 : { *(.debug_str) } |
.debug_loc 0 : { *(.debug_loc) } |
/rtl_sim/src-c/dhrystone_v2.1/omsp_func.c
39,7 → 39,8
// putChar function // |
// (Send a byte to the Port-1) // |
//--------------------------------------------------// |
int putchar (int txdata) { |
//int putchar (int txdata) { |
int tty_putc (int txdata) { |
|
// Write the output character to the Port-1 |
P1OUT = txdata; |
/rtl_sim/src-c/dhrystone_v2.1/mylib/copydata.c
0,0 → 1,15
#include <stdint.h> |
#include <string.h> |
|
extern char __datastart; |
extern char __romdatastart; |
extern char __romdatacopysize; |
static void* const datastart=&__datastart; |
static void* const romdatastart=&__romdatastart; |
static uint16_t const romdatacopysize=(uint16_t)&__romdatacopysize; |
|
__attribute__((constructor)) void __data_move() { |
if (datastart!=romdatastart) { |
memmove(datastart,romdatastart,romdatacopysize); |
} |
} |
/rtl_sim/src-c/dhrystone_v2.1/mylib/cprintf.c
0,0 → 1,158
#include <stdarg.h> |
|
#include "cprintf.h" |
|
typedef unsigned char byte; |
|
static char hex[] = "0123456789abcdef"; |
|
void |
cput_nibble (int n) |
{ |
tty_putc (hex[n&0x0f]); |
} |
|
void |
cput_hex_byte (int n) |
{ |
cput_nibble (n >> 4); |
cput_nibble (n); |
} |
|
void |
cput_binary_byte (int n) |
{ |
int i; |
for (i=7; i>=0; i--) |
tty_putc((n & (1<<i)) ? '1' : '0'); |
} |
|
void |
cput_hex_word (int n) |
{ |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_long (long int n) |
{ |
cput_hex_byte (n >> 24); |
cput_hex_byte (n >> 16); |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_hex_byte (*block++); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
else |
tty_putc (':'); |
} |
} |
|
void |
cput_nibble_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_nibble (*block); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
} |
} |
|
void |
cput_number (int n) |
{ |
char buf[20]; |
int i = 0; |
if (n < 0) |
{ |
tty_putc ('-'); |
n = -n; |
} |
while (n > 9) |
{ |
buf[i++] = (n%10) + '0'; |
n /= 10; |
} |
buf[i++] = (n%10) + '0'; |
while (i > 0) |
tty_putc (buf[--i]); |
} |
|
void |
cprintf (const char *fmt, ...) |
{ |
va_list v; |
int i; |
char *s; |
|
va_start (v, fmt); |
|
while (*fmt) |
{ |
if (*fmt != '%') |
tty_putc (*fmt); |
else |
switch (*++fmt) |
{ |
case '%': |
tty_putc ('%'); |
break; |
case 'c': |
i = va_arg (v, int); |
tty_putc(i); |
break; |
case 'd': |
i = va_arg (v, int); |
cput_number(i); |
break; |
case 'b': |
i = va_arg (v, int); |
cput_hex_byte (i); |
break; |
case 'B': |
i = va_arg (v, int); |
cput_binary_byte (i); |
break; |
case 'w': |
i = va_arg (v, int); |
cput_hex_word (i); |
break; |
case 'l': |
i = va_arg (v, int); |
cput_hex_long (i); |
break; |
case 'x': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_hex_block (s, i); |
break; |
case 'n': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_nibble_block (s, i); |
break; |
case 's': |
s = va_arg (v, char *); |
tty_putc (s); |
break; |
} |
fmt ++; |
} |
} |
/rtl_sim/src-c/dhrystone_v2.1/mylib/cprintf.h
0,0 → 1,158
void cprintf(const char *, ...); |
/rtl_sim/src-c/dhrystone_v2.1/makefile
1,11 → 1,12
# makfile configuration |
NAME = dhrystone_v2.1 |
OBJECTS = dhry_1.o dhry_2.o omsp_func.o copydata.o |
OBJECTS = dhry_1.o dhry_2.o omsp_func.o mylib/copydata.o mylib/cprintf.o |
|
# Compiler performance option (-Os / -O2 / -O3) |
PORT_CFLAGS = -O2 |
|
# Choose GCC toolchain prefix ('msp430' for MSPGCC / 'msp430-elf' for GCC RedHat/TI) |
MSPGCC_PFX = msp430-elf |
ifndef MSPGCC_PFX |
MSPGCC_PFX = msp430 |
endif |
24,11 → 25,12
CC = ${MSPGCC_PFX}-gcc |
OBJCOPY = ${MSPGCC_PFX}-objcopy |
OBJDUMP = ${MSPGCC_PFX}-objdump |
OBJSIZE = ${MSPGCC_PFX}-size |
|
.PHONY: all FORCE clean download dist |
|
#all should be the first target. it's built when make is runwithout args |
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst |
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${NAME}.size |
|
#configure the next line if you want to use the serial download |
download: download-uart |
43,11 → 45,14
${NAME}.lst: ${NAME}.elf |
${OBJDUMP} -dSt $^ >$@ |
|
${NAME}.size: ${NAME}.elf |
${OBJSIZE} $^ >$@ |
|
download-uart: all |
openmsp430-loader.tcl -device /dev/ttyUSB0 -baudrate 115200 ${NAME}.elf |
|
clean: |
rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.elf *.o |
rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.elf ${NAME}.size *.o mylib/*.o |
|
#backup archive |
dist: |
60,4 → 65,5
dhry_1.o: dhry_1.c |
dhry_2.o: dhry_2.c |
omsp_func.o: omsp_func.c |
copydata.o: copydata.c |
mylib/copydata.o: mylib/copydata.c |
mylib/cprintf.o: mylib/cprintf.c |
/rtl_sim/src-c/coremark_v1.0/msp430/copydata.c
File deleted
/rtl_sim/src-c/coremark_v1.0/msp430/linker.msp430.x
5,12 → 5,8
sfr : ORIGIN = 0x0000, LENGTH = 0x0010 |
peripheral_8bit : ORIGIN = 0x0010, LENGTH = 0x00f0 |
peripheral_16bit : ORIGIN = 0x0100, LENGTH = 0x0100 |
|
/* ram (wx) : ORIGIN = 0x0200, LENGTH = 0x2800 /* 10kB */ |
/* rom (rx) : ORIGIN = 0x4000, LENGTH = 0xC000-0x20 /* 48kB */ |
|
ram (wx) : ORIGIN = 0x0200, LENGTH = 0x1400 /* 5kB */ |
rom (rx) : ORIGIN = 0x2800, LENGTH = 0xD800-0x20 /* 54kB */ |
ram (wx) : ORIGIN = 0x0200, LENGTH = 0x2800 /* 10kB */ |
rom (rx) : ORIGIN = 0x4000, LENGTH = 0xC000-0x20 /* 48kB */ |
vectors : ORIGIN = 0xffe0, LENGTH = 0x0020 |
} |
REGION_ALIAS("REGION_TEXT", rom); |
/rtl_sim/src-c/coremark_v1.0/msp430/omsp_func.h
40,7 → 40,8
//---------------------------------------------------------- |
// SPECIAL FUNCTION REGISTERS |
//---------------------------------------------------------- |
#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IE1_set_wdtie() __asm__ __volatile__ ("bis.b #0x01, &0x0000") |
//#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IFG1 (*(volatile unsigned char *) 0x0002) |
|
#define CPU_ID_LO (*(volatile unsigned char *) 0x0004) |
/rtl_sim/src-c/coremark_v1.0/msp430/linker.msp430-elf.x
41,10 → 41,8
SFR : ORIGIN = 0x0000, LENGTH = 0x0010 |
PERIPHERAL_8BIT : ORIGIN = 0x0010, LENGTH = 0x00F0 |
PERIPHERAL_16BIT : ORIGIN = 0x0100, LENGTH = 0x0100 |
/* RAM : ORIGIN = 0x0200, LENGTH = 0x2800 /* 10kB */ |
/* ROM (rx) : ORIGIN = 0x4000, LENGTH = 0xC000-0x20 /* 48kB */ |
RAM : ORIGIN = 0x0200, LENGTH = 0x1400 /* 5kB */ |
ROM (rx) : ORIGIN = 0x2800, LENGTH = 0xD800-0x20 /* 54kB */ |
RAM : ORIGIN = 0x0200, LENGTH = 0x2800 /* 10kB */ |
ROM (rx) : ORIGIN = 0x4000, LENGTH = 0xC000-0x20 /* 48kB */ |
VECT1 : ORIGIN = 0xFFE0, LENGTH = 0x0002 |
VECT2 : ORIGIN = 0xFFE2, LENGTH = 0x0002 |
VECT3 : ORIGIN = 0xFFE4, LENGTH = 0x0002 |
/rtl_sim/src-c/coremark_v1.0/msp430/core_portme.mak
33,7 → 33,7
|
# Flag : PORT_SRCS |
# Port specific source files can be added here |
PORT_SRCS = $(PORT_DIR)/core_portme.c $(PORT_DIR)/omsp_func.c $(PORT_DIR)/copydata.c |
PORT_SRCS = $(PORT_DIR)/core_portme.c $(PORT_DIR)/omsp_func.c $(PORT_DIR)/mylib/copydata.c $(PORT_DIR)/mylib/cprintf.c |
|
# Flag : LOAD |
# For a simple port, we assume self hosted compile and run, no load needed. |
/rtl_sim/src-c/coremark_v1.0/msp430/omsp_func.c
39,7 → 39,8
// putChar function // |
// (Send a byte to the Port-1) // |
//--------------------------------------------------// |
int putchar (int txdata) { |
//int putchar (int txdata) { |
int tty_putc (int txdata) { |
|
// Write the output character to the Port-1 |
P1OUT = txdata; |
/rtl_sim/src-c/coremark_v1.0/msp430/mylib/copydata.c
0,0 → 1,15
#include <stdint.h> |
#include <string.h> |
|
extern char __datastart; |
extern char __romdatastart; |
extern char __romdatacopysize; |
static void* const datastart=&__datastart; |
static void* const romdatastart=&__romdatastart; |
static uint16_t const romdatacopysize=(uint16_t)&__romdatacopysize; |
|
__attribute__((constructor)) void __data_move() { |
if (datastart!=romdatastart) { |
memmove(datastart,romdatastart,romdatacopysize); |
} |
} |
/rtl_sim/src-c/coremark_v1.0/msp430/mylib/cprintf.c
0,0 → 1,158
#include <stdarg.h> |
|
#include "cprintf.h" |
|
typedef unsigned char byte; |
|
static char hex[] = "0123456789abcdef"; |
|
void |
cput_nibble (int n) |
{ |
tty_putc (hex[n&0x0f]); |
} |
|
void |
cput_hex_byte (int n) |
{ |
cput_nibble (n >> 4); |
cput_nibble (n); |
} |
|
void |
cput_binary_byte (int n) |
{ |
int i; |
for (i=7; i>=0; i--) |
tty_putc((n & (1<<i)) ? '1' : '0'); |
} |
|
void |
cput_hex_word (int n) |
{ |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_long (long int n) |
{ |
cput_hex_byte (n >> 24); |
cput_hex_byte (n >> 16); |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_hex_byte (*block++); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
else |
tty_putc (':'); |
} |
} |
|
void |
cput_nibble_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_nibble (*block); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
} |
} |
|
void |
cput_number (int n) |
{ |
char buf[20]; |
int i = 0; |
if (n < 0) |
{ |
tty_putc ('-'); |
n = -n; |
} |
while (n > 9) |
{ |
buf[i++] = (n%10) + '0'; |
n /= 10; |
} |
buf[i++] = (n%10) + '0'; |
while (i > 0) |
tty_putc (buf[--i]); |
} |
|
void |
cprintf (const char *fmt, ...) |
{ |
va_list v; |
int i; |
char *s; |
|
va_start (v, fmt); |
|
while (*fmt) |
{ |
if (*fmt != '%') |
tty_putc (*fmt); |
else |
switch (*++fmt) |
{ |
case '%': |
tty_putc ('%'); |
break; |
case 'c': |
i = va_arg (v, int); |
tty_putc(i); |
break; |
case 'd': |
i = va_arg (v, int); |
cput_number(i); |
break; |
case 'b': |
i = va_arg (v, int); |
cput_hex_byte (i); |
break; |
case 'B': |
i = va_arg (v, int); |
cput_binary_byte (i); |
break; |
case 'w': |
i = va_arg (v, int); |
cput_hex_word (i); |
break; |
case 'l': |
i = va_arg (v, int); |
cput_hex_long (i); |
break; |
case 'x': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_hex_block (s, i); |
break; |
case 'n': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_nibble_block (s, i); |
break; |
case 's': |
s = va_arg (v, char *); |
tty_putc (s); |
break; |
} |
fmt ++; |
} |
} |
/rtl_sim/src-c/coremark_v1.0/msp430/mylib/cprintf.h
0,0 → 1,158
void cprintf(const char *, ...); |
/rtl_sim/src-c/coremark_v1.0/coremark.h
1,21 → 1,21
/* |
Author : Shay Gal-On, EEMBC |
|
This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009 |
All rights reserved. |
This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009 |
All rights reserved. |
|
EEMBC CoreMark Software is a product of EEMBC and is provided under the terms of the |
CoreMark License that is distributed with the official EEMBC COREMARK Software release. |
If you received this EEMBC CoreMark Software without the accompanying CoreMark License, |
you must discontinue use and download the official release from www.coremark.org. |
CoreMark License that is distributed with the official EEMBC COREMARK Software release. |
If you received this EEMBC CoreMark Software without the accompanying CoreMark License, |
you must discontinue use and download the official release from www.coremark.org. |
|
Also, if you are publicly displaying scores generated from the EEMBC CoreMark software, |
Also, if you are publicly displaying scores generated from the EEMBC CoreMark software, |
make sure that you are in compliance with Run and Reporting rules specified in the accompanying readme.txt file. |
|
EEMBC |
EEMBC |
4354 Town Center Blvd. Suite 114-200 |
El Dorado Hills, CA, 95762 |
*/ |
El Dorado Hills, CA, 95762 |
*/ |
/* Topic: Description |
This file contains declarations of the various benchmark functions. |
*/ |
23,7 → 23,7
/* Configuration: TOTAL_DATA_SIZE |
Define total size for data algorithms will operate on |
*/ |
#ifndef TOTAL_DATA_SIZE |
#ifndef TOTAL_DATA_SIZE |
#define TOTAL_DATA_SIZE 2*1000 |
#endif |
|
41,7 → 41,7
#include <stdio.h> |
#endif |
#if HAS_PRINTF |
#define ee_printf printf |
#define ee_printf cprintf |
#endif |
|
/* Actual benchmark execution in iterate */ |
48,7 → 48,7
void *iterate(void *pres); |
|
/* Typedef: secs_ret |
For machines that have floating point support, get number of seconds as a double. |
For machines that have floating point support, get number of seconds as a double. |
Otherwise an unsigned int. |
*/ |
#if HAS_FLOAT |
58,12 → 58,12
#endif |
|
#if MAIN_HAS_NORETURN |
#define MAIN_RETURN_VAL |
#define MAIN_RETURN_VAL |
#define MAIN_RETURN_TYPE void |
#else |
#define MAIN_RETURN_VAL 0 |
#define MAIN_RETURN_TYPE int |
#endif |
#endif |
|
void start_time(void); |
void stop_time(void); |
130,7 → 130,7
NUM_CORE_STATES |
} core_state_e ; |
|
|
|
/* Helper structure to hold results */ |
typedef struct RESULTS_S { |
/* inputs */ |
165,10 → 165,9
|
/* state benchmark functions */ |
void core_init_state(ee_u32 size, ee_s16 seed, ee_u8 *p); |
ee_u16 core_bench_state(ee_u32 blksize, ee_u8 *memblock, |
ee_u16 core_bench_state(ee_u32 blksize, ee_u8 *memblock, |
ee_s16 seed1, ee_s16 seed2, ee_s16 step, ee_u16 crc); |
|
/* matrix benchmark functions */ |
ee_u32 core_init_matrix(ee_u32 blksize, void *memblk, ee_s32 seed, mat_params *p); |
ee_u16 core_bench_matrix(mat_params *p, ee_s16 seed, ee_u16 crc); |
|
/rtl_sim/src-c/coremark_v1.0/coremark_v1.0.v
59,14 → 59,14
// Check CPU configuration |
//--------------------------------------- |
|
if ((`PMEM_SIZE !== 55296) || (`DMEM_SIZE !== 5120)) |
if ((`PMEM_SIZE !== 49152) || (`DMEM_SIZE !== 10240)) |
begin |
$display(" ==============================================="); |
$display("| SIMULATION ERROR |"); |
$display("| |"); |
$display("| Core must be configured for: |"); |
$display("| - 54kB program memory |"); |
$display("| - 5kB data memory |"); |
$display("| - 48kB program memory |"); |
$display("| - 10kB data memory |"); |
$display(" ==============================================="); |
$finish; |
end |
/rtl_sim/src-c/dhrystone_4mcu/copydata.c
File deleted
/rtl_sim/src-c/dhrystone_4mcu/omsp_func.h
40,7 → 40,8
//---------------------------------------------------------- |
// SPECIAL FUNCTION REGISTERS |
//---------------------------------------------------------- |
#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IE1_set_wdtie() __asm__ __volatile__ ("bis.b #0x01, &0x0000") |
//#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IFG1 (*(volatile unsigned char *) 0x0002) |
|
#define CPU_ID_LO (*(volatile unsigned char *) 0x0004) |
121,4 → 122,6
// FUNCTIONS |
//============================================================================= |
|
//int putchar (int txdata); |
// Replace printf statements with custom one |
#include "mylib/cprintf.h" |
#define printf cprintf |
/rtl_sim/src-c/dhrystone_4mcu/linker.msp430-elf.x
237,7 → 237,7
/* DWARF 2 */ |
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
.debug_abbrev 0 : { *(.debug_abbrev) } |
.debug_line 0 : { *(.debug_line) } |
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } |
.debug_frame 0 : { *(.debug_frame) } |
.debug_str 0 : { *(.debug_str) } |
.debug_loc 0 : { *(.debug_loc) } |
/rtl_sim/src-c/dhrystone_4mcu/omsp_func.c
39,7 → 39,8
// putChar function // |
// (Send a byte to the Port-1) // |
//--------------------------------------------------// |
int putchar (int txdata) { |
//int putchar (int txdata) { |
int tty_putc (int txdata) { |
|
// Write the output character to the Port-1 |
P1OUT = txdata; |
/rtl_sim/src-c/dhrystone_4mcu/mylib/copydata.c
0,0 → 1,15
#include <stdint.h> |
#include <string.h> |
|
extern char __datastart; |
extern char __romdatastart; |
extern char __romdatacopysize; |
static void* const datastart=&__datastart; |
static void* const romdatastart=&__romdatastart; |
static uint16_t const romdatacopysize=(uint16_t)&__romdatacopysize; |
|
__attribute__((constructor)) void __data_move() { |
if (datastart!=romdatastart) { |
memmove(datastart,romdatastart,romdatacopysize); |
} |
} |
/rtl_sim/src-c/dhrystone_4mcu/mylib/cprintf.c
0,0 → 1,158
#include <stdarg.h> |
|
#include "cprintf.h" |
|
typedef unsigned char byte; |
|
static char hex[] = "0123456789abcdef"; |
|
void |
cput_nibble (int n) |
{ |
tty_putc (hex[n&0x0f]); |
} |
|
void |
cput_hex_byte (int n) |
{ |
cput_nibble (n >> 4); |
cput_nibble (n); |
} |
|
void |
cput_binary_byte (int n) |
{ |
int i; |
for (i=7; i>=0; i--) |
tty_putc((n & (1<<i)) ? '1' : '0'); |
} |
|
void |
cput_hex_word (int n) |
{ |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_long (long int n) |
{ |
cput_hex_byte (n >> 24); |
cput_hex_byte (n >> 16); |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_hex_byte (*block++); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
else |
tty_putc (':'); |
} |
} |
|
void |
cput_nibble_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_nibble (*block); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
} |
} |
|
void |
cput_number (int n) |
{ |
char buf[20]; |
int i = 0; |
if (n < 0) |
{ |
tty_putc ('-'); |
n = -n; |
} |
while (n > 9) |
{ |
buf[i++] = (n%10) + '0'; |
n /= 10; |
} |
buf[i++] = (n%10) + '0'; |
while (i > 0) |
tty_putc (buf[--i]); |
} |
|
void |
cprintf (const char *fmt, ...) |
{ |
va_list v; |
int i; |
char *s; |
|
va_start (v, fmt); |
|
while (*fmt) |
{ |
if (*fmt != '%') |
tty_putc (*fmt); |
else |
switch (*++fmt) |
{ |
case '%': |
tty_putc ('%'); |
break; |
case 'c': |
i = va_arg (v, int); |
tty_putc(i); |
break; |
case 'd': |
i = va_arg (v, int); |
cput_number(i); |
break; |
case 'b': |
i = va_arg (v, int); |
cput_hex_byte (i); |
break; |
case 'B': |
i = va_arg (v, int); |
cput_binary_byte (i); |
break; |
case 'w': |
i = va_arg (v, int); |
cput_hex_word (i); |
break; |
case 'l': |
i = va_arg (v, int); |
cput_hex_long (i); |
break; |
case 'x': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_hex_block (s, i); |
break; |
case 'n': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_nibble_block (s, i); |
break; |
case 's': |
s = va_arg (v, char *); |
tty_putc (s); |
break; |
} |
fmt ++; |
} |
} |
/rtl_sim/src-c/dhrystone_4mcu/mylib/cprintf.h
0,0 → 1,158
void cprintf(const char *, ...); |
/rtl_sim/src-c/dhrystone_4mcu/makefile
1,11 → 1,12
# makfile configuration |
NAME = dhrystone_4mcu |
OBJECTS = dhry21a.o dhry21b.o omsp_func.o copydata.o |
OBJECTS = dhry21a.o dhry21b.o omsp_func.o mylib/copydata.o mylib/cprintf.o |
|
# Compiler performance option (-Os / -O2 / -O3) |
PORT_CFLAGS = -O2 |
|
# Choose GCC toolchain prefix ('msp430' for MSPGCC / 'msp430-elf' for GCC RedHat/TI) |
MSPGCC_PFX = msp430-elf |
ifndef MSPGCC_PFX |
MSPGCC_PFX = msp430 |
endif |
24,11 → 25,12
CC = ${MSPGCC_PFX}-gcc |
OBJCOPY = ${MSPGCC_PFX}-objcopy |
OBJDUMP = ${MSPGCC_PFX}-objdump |
OBJSIZE = ${MSPGCC_PFX}-size |
|
.PHONY: all FORCE clean download dist |
|
#all should be the first target. it's built when make is runwithout args |
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst |
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${NAME}.size |
|
#configure the next line if you want to use the serial download |
download: download-uart |
43,11 → 45,14
${NAME}.lst: ${NAME}.elf |
${OBJDUMP} -dSt $^ >$@ |
|
${NAME}.size: ${NAME}.elf |
${OBJSIZE} $^ >$@ |
|
download-uart: all |
openmsp430-loader.tcl -device /dev/ttyUSB0 -baudrate 115200 ${NAME}.elf |
|
clean: |
rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.elf *.o |
rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.elf ${NAME}.size *.o mylib/*.o |
|
#backup archive |
dist: |
60,4 → 65,5
dhry_21a.o: dhry_21a.c |
dhry_21b.o: dhry_21b.c |
omsp_func.o: omsp_func.c |
copydata.o: copydata.c |
mylib/copydata.o: mylib/copydata.c |
mylib/cprintf.o: mylib/cprintf.c |
/rtl_sim/src-c/sandbox/copydata.c
File deleted
/rtl_sim/src-c/sandbox/linker.msp430-elf.x
237,7 → 237,7
/* DWARF 2 */ |
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
.debug_abbrev 0 : { *(.debug_abbrev) } |
.debug_line 0 : { *(.debug_line) } |
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } |
.debug_frame 0 : { *(.debug_frame) } |
.debug_str 0 : { *(.debug_str) } |
.debug_loc 0 : { *(.debug_loc) } |
/rtl_sim/src-c/sandbox/omsp_system.h
40,7 → 40,8
//---------------------------------------------------------- |
// SPECIAL FUNCTION REGISTERS |
//---------------------------------------------------------- |
#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IE1_set_wdtie() __asm__ __volatile__ ("bis.b #0x01, &0x0000") |
//#define IE1 (*(volatile unsigned char *) 0x0000) |
#define IFG1 (*(volatile unsigned char *) 0x0002) |
|
#define CPU_ID_LO (*(volatile unsigned char *) 0x0004) |
/rtl_sim/src-c/sandbox/mylib/copydata.c
0,0 → 1,15
#include <stdint.h> |
#include <string.h> |
|
extern char __datastart; |
extern char __romdatastart; |
extern char __romdatacopysize; |
static void* const datastart=&__datastart; |
static void* const romdatastart=&__romdatastart; |
static uint16_t const romdatacopysize=(uint16_t)&__romdatacopysize; |
|
__attribute__((constructor)) void __data_move() { |
if (datastart!=romdatastart) { |
memmove(datastart,romdatastart,romdatacopysize); |
} |
} |
/rtl_sim/src-c/sandbox/mylib/cprintf.c
0,0 → 1,158
#include <stdarg.h> |
|
#include "cprintf.h" |
|
typedef unsigned char byte; |
|
static char hex[] = "0123456789abcdef"; |
|
void |
cput_nibble (int n) |
{ |
tty_putc (hex[n&0x0f]); |
} |
|
void |
cput_hex_byte (int n) |
{ |
cput_nibble (n >> 4); |
cput_nibble (n); |
} |
|
void |
cput_binary_byte (int n) |
{ |
int i; |
for (i=7; i>=0; i--) |
tty_putc((n & (1<<i)) ? '1' : '0'); |
} |
|
void |
cput_hex_word (int n) |
{ |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_long (long int n) |
{ |
cput_hex_byte (n >> 24); |
cput_hex_byte (n >> 16); |
cput_hex_byte (n >> 8); |
cput_hex_byte (n); |
} |
|
void |
cput_hex_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_hex_byte (*block++); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
else |
tty_putc (':'); |
} |
} |
|
void |
cput_nibble_block (char *block, int n) |
{ |
int i = 0; |
while (n) |
{ |
cput_nibble (*block); |
if (--n == 0) |
break; |
i++; |
if ((i & 7) == 0) |
tty_putc (' '); |
} |
} |
|
void |
cput_number (int n) |
{ |
char buf[20]; |
int i = 0; |
if (n < 0) |
{ |
tty_putc ('-'); |
n = -n; |
} |
while (n > 9) |
{ |
buf[i++] = (n%10) + '0'; |
n /= 10; |
} |
buf[i++] = (n%10) + '0'; |
while (i > 0) |
tty_putc (buf[--i]); |
} |
|
void |
cprintf (const char *fmt, ...) |
{ |
va_list v; |
int i; |
char *s; |
|
va_start (v, fmt); |
|
while (*fmt) |
{ |
if (*fmt != '%') |
tty_putc (*fmt); |
else |
switch (*++fmt) |
{ |
case '%': |
tty_putc ('%'); |
break; |
case 'c': |
i = va_arg (v, int); |
tty_putc(i); |
break; |
case 'd': |
i = va_arg (v, int); |
cput_number(i); |
break; |
case 'b': |
i = va_arg (v, int); |
cput_hex_byte (i); |
break; |
case 'B': |
i = va_arg (v, int); |
cput_binary_byte (i); |
break; |
case 'w': |
i = va_arg (v, int); |
cput_hex_word (i); |
break; |
case 'l': |
i = va_arg (v, int); |
cput_hex_long (i); |
break; |
case 'x': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_hex_block (s, i); |
break; |
case 'n': |
s = va_arg (v, char *); |
i = va_arg (v, int); |
cput_nibble_block (s, i); |
break; |
case 's': |
s = va_arg (v, char *); |
tty_putc (s); |
break; |
} |
fmt ++; |
} |
} |
/rtl_sim/src-c/sandbox/mylib/cprintf.h
0,0 → 1,158
void cprintf(const char *, ...); |
/rtl_sim/src-c/sandbox/makefile
1,8 → 1,9
# makfile configuration |
NAME = sandbox |
OBJECTS = main.o copydata.o |
OBJECTS = main.o mylib/copydata.o |
|
# Choose GCC toolchain prefix ('msp430' for MSPGCC / 'msp430-elf' for GCC RedHat/TI) |
MSPGCC_PFX = msp430-elf |
ifndef MSPGCC_PFX |
MSPGCC_PFX = msp430 |
endif |
18,12 → 19,12
CC = ${MSPGCC_PFX}-gcc |
OBJCOPY = ${MSPGCC_PFX}-objcopy |
OBJDUMP = ${MSPGCC_PFX}-objdump |
OBJSIZE = ${MSPGCC_PFX}-size |
|
|
.PHONY: all FORCE clean download download-jtag download-bsl dist |
|
#all should be the first target. it's built when make is runwithout args |
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst |
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${NAME}.size |
|
#confgigure the next line if you want to use the serial download |
download: download-uart |
38,11 → 39,14
${NAME}.lst: ${NAME}.elf |
${OBJDUMP} -dSt $^ >$@ |
|
${NAME}.size: ${NAME}.elf |
${OBJSIZE} $^ >$@ |
|
download-uart: all |
openmsp430-loader.tcl -device /dev/ttyUSB0 -baudrate 115200 ${NAME}.elf |
|
clean: |
rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.elf *.o |
rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.elf ${NAME}.size *.o mylib/*.o |
|
#backup archive |
dist: |
53,4 → 57,4
|
#project dependencies |
main.o: main.c |
copydata.o: copydata.c |
mylib/copydata.o: mylib/copydata.c |