URL
https://opencores.org/ocsvn/de1_olpcl2294_system/de1_olpcl2294_system/trunk
Subversion Repositories de1_olpcl2294_system
Compare Revisions
- This comparison shows the changes necessary to convert path
/de1_olpcl2294_system/trunk/sw/ecos/debug
- from Rev 2 to Rev 3
- ↔ Reverse comparison
Rev 2 → Rev 3
/lib_dbg_sh.h
1,92 → 1,92
// |
// |
// |
|
|
#include <pkgconf/hal.h> |
#include <cyg/hal/hal_if.h> |
#include <cyg/hal/hal_tables.h> |
|
|
// CLI support functions |
// externC bool parse_num(char *s, unsigned long *val, char **es, char *delim); |
// externC bool parse_bool(char *s, bool *val); |
|
typedef void cmd_fun(int argc, char *argv[]); |
struct cmd { |
char *str; |
char *help; |
char *usage; |
cmd_fun *fun; |
struct cmd *sub_cmds, *sub_cmds_end; |
} CYG_HAL_TABLE_TYPE; |
// externC struct cmd *cmd_search(struct cmd *tab, struct cmd *tabend, char *arg); |
// externC void cmd_usage(struct cmd *tab, struct cmd *tabend, char *prefix); |
#define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,0,0,RedBoot_commands) |
#define RedBoot_nested_cmd(_s_,_h_,_u_,_f_,_subs_,_sube_) cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,RedBoot_commands) |
#define _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \ |
cmd_fun _f_; \ |
struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_, _subs_, _sube_}; |
#define cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \ |
extern _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) |
#define local_cmd_entry(_s_,_h_,_u_,_f_,_n_) \ |
static _cmd_entry(_s_,_h_,_u_,_f_,0,0,_n_) |
|
#define CYGBLD_REDBOOT_MAX_MEM_SEGMENTS 1 |
#define CYGNUM_REDBOOT_CMD_LINE_EDITING 16 |
|
#define MAX_ARGV 16 |
|
// Option processing support |
|
struct option_info { |
char flag; |
bool takes_arg; |
int arg_type; |
void *arg; |
bool *arg_set; |
char *name; |
}; |
|
#define NUM_ELEMS(s) (sizeof(s)/sizeof(s[0])) |
|
#define OPTION_ARG_TYPE_NUM 0 // Numeric data |
#define OPTION_ARG_TYPE_STR 1 // Generic string |
#define OPTION_ARG_TYPE_FLG 2 // Flag only |
|
|
// Command line parsing |
externC struct cmd *parse(char **line, int *argc, char **argv); |
|
externC void init_opts(struct option_info *opts, char flag, bool takes_arg, |
int arg_type, void *arg, bool *arg_set, char *name); |
externC bool scan_opts(int argc, char *argv[], int first, |
struct option_info *opts, int num_opts, |
void *def_arg, int def_arg_type, char *def_descr); |
|
|
// RedBoot_cmd( |
// "iopeek", |
// "Read I/O location", |
// "[-b <location>] [-1|2|4]", |
// do_iopeek |
// ); |
|
// RedBoot_cmd( |
// "iopoke", |
// "Write I/O location", |
// "[-b <location>] [-1|2|4] -v <value>", |
// do_iopoke |
// ); |
|
|
// static void do_memtest (int argc, char *argv[]); |
// |
// RedBoot_cmd( |
// "memtest", |
// "Manage do_memtest", |
// "-b <location> -l <length>", |
// do_memtest |
// ); |
|
// |
// |
// |
|
|
#include <pkgconf/hal.h> |
#include <cyg/hal/hal_if.h> |
#include <cyg/hal/hal_tables.h> |
|
|
// CLI support functions |
// externC bool parse_num(char *s, unsigned long *val, char **es, char *delim); |
// externC bool parse_bool(char *s, bool *val); |
|
typedef void cmd_fun(int argc, char *argv[]); |
struct cmd { |
char *str; |
char *help; |
char *usage; |
cmd_fun *fun; |
struct cmd *sub_cmds, *sub_cmds_end; |
} CYG_HAL_TABLE_TYPE; |
// externC struct cmd *cmd_search(struct cmd *tab, struct cmd *tabend, char *arg); |
// externC void cmd_usage(struct cmd *tab, struct cmd *tabend, char *prefix); |
#define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,0,0,RedBoot_commands) |
#define RedBoot_nested_cmd(_s_,_h_,_u_,_f_,_subs_,_sube_) cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,RedBoot_commands) |
#define _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \ |
cmd_fun _f_; \ |
struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_, _subs_, _sube_}; |
#define cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \ |
extern _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) |
#define local_cmd_entry(_s_,_h_,_u_,_f_,_n_) \ |
static _cmd_entry(_s_,_h_,_u_,_f_,0,0,_n_) |
|
#define CYGBLD_REDBOOT_MAX_MEM_SEGMENTS 1 |
#define CYGNUM_REDBOOT_CMD_LINE_EDITING 16 |
|
#define MAX_ARGV 16 |
|
// Option processing support |
|
struct option_info { |
char flag; |
bool takes_arg; |
int arg_type; |
void *arg; |
bool *arg_set; |
char *name; |
}; |
|
#define NUM_ELEMS(s) (sizeof(s)/sizeof(s[0])) |
|
#define OPTION_ARG_TYPE_NUM 0 // Numeric data |
#define OPTION_ARG_TYPE_STR 1 // Generic string |
#define OPTION_ARG_TYPE_FLG 2 // Flag only |
|
|
// Command line parsing |
externC struct cmd *parse(char **line, int *argc, char **argv); |
|
externC void init_opts(struct option_info *opts, char flag, bool takes_arg, |
int arg_type, void *arg, bool *arg_set, char *name); |
externC bool scan_opts(int argc, char *argv[], int first, |
struct option_info *opts, int num_opts, |
void *def_arg, int def_arg_type, char *def_descr); |
|
|
// RedBoot_cmd( |
// "iopeek", |
// "Read I/O location", |
// "[-b <location>] [-1|2|4]", |
// do_iopeek |
// ); |
|
// RedBoot_cmd( |
// "iopoke", |
// "Write I/O location", |
// "[-b <location>] [-1|2|4] -v <value>", |
// do_iopoke |
// ); |
|
|
// static void do_memtest (int argc, char *argv[]); |
// |
// RedBoot_cmd( |
// "memtest", |
// "Manage do_memtest", |
// "-b <location> -l <length>", |
// do_memtest |
// ); |
|
|
/main.c
1,77 → 1,70
// |
// |
// |
|
#include <stdio.h> |
#include <math.h> |
#include <stdlib.h> |
|
#include <cyg/kernel/kapi.h> |
|
#include "LPC22xx.h" |
#include "lib_dbg_sh.h" |
|
extern void dbg_sh(void); |
|
|
/* now declare (and allocate space for) some kernel objects, |
like the two threads we will use */ |
cyg_thread thread_s[2]; /* space for two thread objects */ |
|
char stack[2][4096]; /* space for two 4K stacks */ |
|
/* now the handles for the threads */ |
cyg_handle_t simple_threadA, simple_threadB; |
|
/* and now variables for the procedure which is the thread */ |
cyg_thread_entry_t simple_program; |
|
/* and now a mutex to protect calls to the C library */ |
cyg_mutex_t cliblock; |
|
/* we install our own startup routine which sets up threads */ |
void cyg_user_start(void) |
{ |
// printf("Entering twothreads' cyg_user_start() function\n"); |
|
// enable cs3 |
PINSEL2 = 0x0f814924; |
|
// configure BCFG3 |
*((unsigned int *)0xFFE0000C) = 0x20007de7; |
|
|
cyg_mutex_init(&cliblock); |
|
cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, |
"Thread A", (void *) stack[0], 4096, |
&simple_threadA, &thread_s[0]); |
// cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, |
// "Thread B", (void *) stack[1], 4096, |
// &simple_threadB, &thread_s[1]); |
|
cyg_thread_resume(simple_threadA); |
// cyg_thread_resume(simple_threadB); |
} |
|
/* this is a simple program which runs in a thread */ |
void simple_program(cyg_addrword_t data) |
{ |
int message = (int) data; |
int delay; |
|
printf("Beginning execution; thread data is %d\n", message); |
|
dbg_sh(); |
|
} |
|
|
int main(void) |
{ |
|
|
|
return( -1 ); |
} |
|
// |
// |
// |
|
#include <stdio.h> |
#include <math.h> |
#include <stdlib.h> |
|
#include <cyg/kernel/kapi.h> |
|
#include "LPC22xx.h" |
#include "lib_dbg_sh.h" |
|
extern void dbg_sh(void); |
|
|
/* now declare (and allocate space for) some kernel objects, |
like the two threads we will use */ |
cyg_thread thread_s[2]; /* space for two thread objects */ |
|
char stack[2][4096]; /* space for two 4K stacks */ |
|
/* now the handles for the threads */ |
cyg_handle_t simple_threadA, simple_threadB; |
|
/* and now variables for the procedure which is the thread */ |
cyg_thread_entry_t simple_program; |
|
/* and now a mutex to protect calls to the C library */ |
cyg_mutex_t cliblock; |
|
/* we install our own startup routine which sets up threads */ |
void cyg_user_start(void) |
{ |
// printf("Entering twothreads' cyg_user_start() function\n"); |
|
// enable cs3 |
PINSEL2 = 0x0f814924; |
|
// configure BCFG3 |
*((unsigned int *)0xFFE0000C) = 0x20007de7; |
|
|
cyg_mutex_init(&cliblock); |
|
cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, |
"Thread A", (void *) stack[0], 4096, |
&simple_threadA, &thread_s[0]); |
// cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, |
// "Thread B", (void *) stack[1], 4096, |
// &simple_threadB, &thread_s[1]); |
|
cyg_thread_resume(simple_threadA); |
// cyg_thread_resume(simple_threadB); |
} |
|
/* this is a simple program which runs in a thread */ |
void simple_program(cyg_addrword_t data) |
{ |
int message = (int) data; |
int delay; |
|
printf("Beginning execution; thread data is %d\n", message); |
|
dbg_sh(); |
|
} |
|
|
|
/Makefile
1,48 → 1,48
# Mostly written by Jonathan Larmour, Red Hat, Inc. |
# Reference to ecos.mak added by John Dallaway, eCosCentric Limited, 2003-01-20 |
# This file is in the public domain and may be used for any purpose |
|
# Usage: make INSTALL_DIR=/path/to/ecos/install |
|
# INSTALL_DIR=$$(INSTALL_DIR) # override on make command line |
# INSTALL_DIR = ../ROM_slow/install |
INSTALL_DIR = ../LPC2294_ram/LPC2294_ram_install |
|
OBJECT_FILES = main.o |
HEADER_FILES = lpc22xx.h lib_dbg_sh.h |
|
|
include $(INSTALL_DIR)/include/pkgconf/ecos.mak |
|
XCC = $(ECOS_COMMAND_PREFIX)gcc |
XCXX = $(XCC) |
XLD = $(XCC) |
|
CFLAGS = -I$(INSTALL_DIR)/include |
CXXFLAGS = $(CFLAGS) |
LDFLAGS = -nostartfiles -L$(INSTALL_DIR)/lib -Ttarget.ld |
|
# RULES |
|
.PHONY: all clean |
|
all: debug |
|
clean: |
-rm -f debug $(OBJECT_FILES) |
|
%.o: %.c |
$(XCC) -c -o $*.o $(CFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
%.o: %.cxx |
$(XCXX) -c -o $*.o $(CXXFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
%.o: %.C |
$(XCXX) -c -o $*.o $(CXXFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
%.o: %.cc |
$(XCXX) -c -o $*.o $(CXXFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
debug: $(OBJECT_FILES) $(HEADER_FILES) |
$(XLD) $(LDFLAGS) $(ECOS_GLOBAL_LDFLAGS) -o $@ $(OBJECT_FILES) -static -L../shell -ldbg_sh |
|
# Mostly written by Jonathan Larmour, Red Hat, Inc. |
# Reference to ecos.mak added by John Dallaway, eCosCentric Limited, 2003-01-20 |
# This file is in the public domain and may be used for any purpose |
|
# Usage: make INSTALL_DIR=/path/to/ecos/install |
|
# INSTALL_DIR=$$(INSTALL_DIR) # override on make command line |
# INSTALL_DIR = ../ROM_slow/install |
INSTALL_DIR = ../LPC2294_ram/LPC2294_ram_install |
|
OBJECT_FILES = main.o |
HEADER_FILES = lpc22xx.h lib_dbg_sh.h |
|
|
include $(INSTALL_DIR)/include/pkgconf/ecos.mak |
|
XCC = $(ECOS_COMMAND_PREFIX)gcc |
XCXX = $(XCC) |
XLD = $(XCC) |
|
CFLAGS = -I$(INSTALL_DIR)/include |
CXXFLAGS = $(CFLAGS) |
LDFLAGS = -nostartfiles -L$(INSTALL_DIR)/lib -Ttarget.ld |
|
# RULES |
|
.PHONY: all clean |
|
all: debug |
|
clean: |
-rm -f debug $(OBJECT_FILES) |
|
%.o: %.c |
$(XCC) -c -o $*.o $(CFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
%.o: %.cxx |
$(XCXX) -c -o $*.o $(CXXFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
%.o: %.C |
$(XCXX) -c -o $*.o $(CXXFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
%.o: %.cc |
$(XCXX) -c -o $*.o $(CXXFLAGS) $(ECOS_GLOBAL_CFLAGS) $< |
|
debug: $(OBJECT_FILES) $(HEADER_FILES) |
$(XLD) $(LDFLAGS) $(ECOS_GLOBAL_LDFLAGS) -o $@ $(OBJECT_FILES) -static -L../shell -ldbg_sh |
|