├── .gitignore ├── .gitlab └── gitlab-ci.yml ├── .gitmodules ├── CODEOWNERS ├── LICENSE.md ├── Makefile ├── README.md ├── benchmarks ├── Makefile ├── nbench │ ├── Makefile │ ├── README │ ├── main.c │ ├── nbench-byte-2.2.3 │ │ ├── COM.DAT │ │ ├── Changes │ │ ├── Makefile │ │ ├── NNET.DAT │ │ ├── README │ │ ├── README.motorola │ │ ├── README.nonlinux │ │ ├── README.submit │ │ ├── RESULTS │ │ ├── bdoc.txt │ │ ├── debugbit.good.gz │ │ ├── emfloat.c │ │ ├── emfloat.h │ │ ├── hardware.c │ │ ├── hardware.h │ │ ├── hello.c │ │ ├── misc.c │ │ ├── misc.h │ │ ├── nbench0.c │ │ ├── nbench0.h │ │ ├── nbench1.c │ │ ├── nbench1.h │ │ ├── nmglobal.h │ │ ├── pointer.c │ │ ├── pointer.h │ │ ├── sysinfo.c │ │ ├── sysinfo.c.example │ │ ├── sysinfo.c.template │ │ ├── sysinfo.sh │ │ ├── sysinfoc.c │ │ ├── sysinfoc.c.example │ │ ├── sysinfoc.c.template │ │ ├── sysspec.c │ │ ├── sysspec.h │ │ └── wordcat.h │ └── wscript └── wscript ├── c11 ├── README.txt ├── c11_cndvar01 │ ├── Makefile │ ├── rtems_config.c │ ├── test.c │ └── wscript ├── c11_key01 │ ├── Makefile │ ├── rtems_config.c │ ├── test.c │ └── wscript ├── c11_mutex01 │ ├── Makefile │ ├── rtems_config.c │ ├── test.c │ └── wscript ├── c11_thread01 │ ├── Makefile │ ├── rtems_config.c │ ├── test.c │ └── wscript └── wscript ├── classic_api ├── Makefile ├── classic_signal │ ├── Makefile │ ├── test.c │ └── wscript ├── triple_period │ ├── Makefile │ ├── init.c │ ├── system.h │ ├── tasks.c │ └── wscript └── wscript ├── cxx ├── Makefile ├── cxx_stdmap │ ├── Makefile │ ├── main.cc │ ├── rtems_config.c │ └── wscript ├── cxx_throw │ ├── MAIL │ ├── Makefile │ ├── init.cc │ └── wscript ├── libcpp │ ├── Makefile │ ├── README │ ├── foo.cc │ ├── foo.h │ ├── foo1.cpp │ └── wscript └── wscript ├── file_io ├── Makefile ├── crc │ ├── .gitignore │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── crc.h │ ├── crc_32.c │ ├── init.c │ ├── rootfs │ │ └── image.img │ ├── sniptype.h │ └── wscript ├── fdopen │ ├── Makefile │ ├── README │ ├── fdopen.ini │ ├── test.c │ └── wscript ├── filerdback │ ├── Makefile │ ├── README │ ├── test.c │ └── wscript ├── repeated_opens │ ├── Makefile │ ├── README │ ├── test.c │ └── wscript └── wscript ├── filesystem └── fat_ramdisk │ ├── Makefile │ ├── README │ ├── fat_ramdisk.ini │ ├── init.c │ ├── rootfs │ └── shell-init │ └── wscript ├── gdb ├── README ├── overwrite │ ├── Makefile │ ├── README │ ├── overwrite.c │ ├── rtems_init.c │ └── wscript └── wscript ├── hello ├── Makefile ├── both_hello │ ├── Makefile │ ├── test.c │ └── wscript ├── hello_world_c │ ├── Makefile │ ├── test.c │ └── wscript ├── portable_hello │ ├── Makefile │ ├── rtems_config.c │ ├── test.c │ └── wscript ├── posix_hello_world │ ├── Makefile │ ├── test.c │ └── wscript └── wscript ├── led ├── Makefile ├── README ├── complex1 │ ├── LocalMessageQueuePOSIX10031c.h │ ├── Makefile │ ├── Makefile.linux │ ├── MessageQueueT.h │ ├── MessageQueueT_BASE.h │ ├── ledServer.h │ ├── main.cc │ ├── menu.cc │ ├── menu.h │ ├── periodic.c │ ├── periodic.h │ ├── test.cc │ └── wscript ├── delay │ ├── Makefile │ ├── init.c │ └── wscript ├── event_server │ ├── Makefile │ ├── init.c │ └── wscript ├── led.h ├── msg_server │ ├── Makefile │ ├── init.c │ └── wscript ├── posix_cond_server │ ├── Makefile │ ├── test.c │ └── wscript ├── posix_delay_nanosleep │ ├── Makefile │ ├── test.c │ └── wscript ├── posix_delay_sleep │ ├── Makefile │ ├── test.c │ └── wscript ├── posix_mutex_server │ ├── Makefile │ ├── test.c │ └── wscript ├── ratemon1 │ ├── Makefile │ ├── init.c │ └── wscript ├── ratemon2 │ ├── Makefile │ ├── init.c │ └── wscript ├── ratemon_cond_server │ ├── Makefile │ ├── test.c │ └── wscript ├── sem_server │ ├── Makefile │ ├── init.c │ └── wscript ├── timeout_event │ ├── Makefile │ ├── init.c │ └── wscript ├── timer │ ├── Makefile │ ├── init.c │ └── wscript ├── timer_server │ ├── Makefile │ ├── init.c │ └── wscript └── wscript ├── lvgl ├── README ├── gui │ ├── rtems_logo.h │ ├── test.c │ └── wscript ├── hello │ ├── test.c │ └── wscript └── wscript ├── micromonitor ├── README ├── diagnostics │ ├── README │ ├── appboot │ ├── cfg.h │ ├── cli.h │ ├── cstart.c │ ├── main.c │ ├── makefile │ ├── monlib.c │ ├── monlib.h │ └── tfs.h ├── umon │ ├── Makefile │ ├── README │ ├── test.c │ └── wscript └── wscript ├── misc ├── Makefile ├── adamain │ ├── Makefile │ ├── README │ ├── adacode.c │ ├── rtems_init.c │ └── wscript ├── applib │ ├── Makefile │ ├── file_1.c │ ├── private.h │ ├── userLib.h │ └── wscript ├── bspcmdline │ ├── Makefile │ ├── README │ ├── test.c │ └── wscript ├── extract_example │ ├── .gitignore │ ├── Makefile │ └── README ├── minimum │ ├── Makefile │ ├── test.c │ └── wscript ├── nanosecond_tick_wrap │ ├── Makefile │ ├── README │ ├── init.c │ └── wscript ├── qemu_vfat │ ├── Makefile │ ├── README │ ├── init.c │ ├── start_test.c │ ├── system.h │ └── wscript ├── regulator │ ├── Makefile │ ├── regulator_example.c │ ├── rtems_config.c │ └── wscript ├── userdrv │ ├── Makefile │ ├── main.c │ ├── mainpage.h │ ├── rtems_config.c │ ├── userdrv.c │ ├── userdrv.cfg │ ├── userdrv.h │ └── wscript ├── wscript └── x86_display_cpu │ ├── Makefile │ ├── test.c │ └── wscript ├── posix_api ├── Makefile ├── livermore │ ├── Makefile │ ├── pthread │ │ ├── Makefile │ │ ├── README │ │ ├── init.c │ │ └── wscript │ └── wscript ├── psx_barrier_report │ ├── Makefile │ ├── barrier_attr_report.c │ ├── rtems_config.c │ └── wscript ├── psx_condvar_report │ ├── Makefile │ ├── condvar_attr_report.c │ ├── rtems_config.c │ └── wscript ├── psx_example_1 │ ├── Makefile │ ├── test1.c │ └── wscript ├── psx_example_2 │ ├── Makefile │ ├── test2.c │ └── wscript ├── psx_example_3 │ ├── Makefile │ ├── test3.c │ └── wscript ├── psx_initial_sigmask │ ├── Makefile │ ├── main.c │ ├── rtems_config.c │ └── wscript ├── psx_mqueue_report │ ├── Makefile │ ├── mqueue_attr_report.c │ ├── rtems_config.c │ └── wscript ├── psx_mutex_report │ ├── Makefile │ ├── mutex_attr_report.c │ ├── rtems_config.c │ └── wscript ├── psx_pthread_report │ ├── Makefile │ ├── pthread_attr_report.c │ ├── rtems_config.c │ └── wscript ├── psx_rwlock_report │ ├── Makefile │ ├── rtems_config.c │ ├── rwlock_attr_report.c │ └── wscript ├── psx_sched_report │ ├── Makefile │ ├── README │ ├── psx_sched_report.c │ ├── rtems_config.c │ └── wscript ├── psx_sigint │ ├── Makefile │ ├── main.c │ ├── rtems_config.c │ └── wscript ├── psx_task_restart │ ├── Makefile │ ├── psx_task_restart.c │ ├── rtems_config.c │ └── wscript ├── psx_thread_restart │ ├── Makefile │ ├── psx_thread_restart.c │ ├── rtems_config.c │ └── wscript └── wscript ├── schedsim └── schedsim_priority │ ├── Makefile │ ├── README │ ├── config.c │ ├── example_script │ ├── printheir_executing.c │ ├── schedsim.cc │ └── wrap_thread_dispatch.c ├── testmacros.h ├── ticker ├── Makefile ├── low_ticker │ ├── Makefile │ ├── init.c │ └── wscript ├── low_ticker1 │ ├── Makefile │ ├── init.c │ └── wscript ├── low_ticker2 │ ├── Makefile │ ├── init.c │ └── wscript ├── ticker │ ├── Makefile │ ├── init.c │ └── wscript ├── ticker_stackchk │ ├── Makefile │ ├── init.c │ └── wscript ├── ticker_trace │ ├── Makefile │ ├── init.c │ ├── ticker-deep.ini │ ├── ticker.ini │ └── wscript └── wscript ├── uboot ├── Makefile ├── uboot_getenv │ ├── Makefile │ ├── README │ ├── test.c │ └── wscript └── wscript ├── waf └── wscript /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .lock-waf_* 3 | .waf*-* 4 | *~ 5 | build/* 6 | -------------------------------------------------------------------------------- /.gitlab/gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - project: 'administration/integration' 3 | file: 4 | - 'ci/config/rtems.yml' 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "rtems_waf"] 2 | path = rtems_waf 3 | url = https://gitlab.rtems.org/rtems/tools/rtems_waf.git 4 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Please keep users, directories and files sorted alphabetically. 2 | # Directories first 3 | 4 | [General Maintainer] @approvers/general/maintainer 5 | * 6 | 7 | [Documentation] @approvers/docs 8 | */README 9 | *.md 10 | *.txt 11 | 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS=classic_api posix_api hello led misc ticker file_io \ 6 | benchmarks 7 | 8 | # Monitor Specific Examples 9 | SUBDIRS += uboot 10 | 11 | # Language Specific Examples 12 | SUBDIRS += cxx 13 | -------------------------------------------------------------------------------- /benchmarks/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS=nbench 6 | -------------------------------------------------------------------------------- /benchmarks/nbench/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | VPATH=.:nbench-byte-2.2.3 6 | PGM=${ARCH}/nbench.exe 7 | 8 | # C source names 9 | CSRCS = main.c \ 10 | emfloat.c \ 11 | hardware.c \ 12 | misc.c \ 13 | nbench0.c \ 14 | nbench1.c \ 15 | sysspec.c 16 | 17 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 18 | 19 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 20 | include $(RTEMS_CUSTOM) 21 | include $(PROJECT_ROOT)/make/leaf.cfg 22 | 23 | LINK_LIBS += -lm 24 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 25 | 26 | all: ${ARCH} $(PGM) 27 | 28 | $(PGM): $(OBJS) 29 | $(make-exe) 30 | -------------------------------------------------------------------------------- /benchmarks/nbench/README: -------------------------------------------------------------------------------- 1 | Byte nbench Benchmark 2 | 3 | SOURCE: http://www.tux.org/~mayer/linux/bmark.html 4 | 5 | Ported to RTEMS by Petri Rokka (petri.rokka@tut.fi). 6 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/COM.DAT: -------------------------------------------------------------------------------- 1 | ALLSTATS=T 2 | DONUMSORT=T 3 | DOSTRINGSORT=T 4 | DOBITFIELD=T 5 | DOEMF=T 6 | DOFOUR=T 7 | DOASSIGN=T 8 | DOIDEA=T 9 | DOHUFF=T 10 | DONNET=T 11 | DOLU=T 12 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/Changes: -------------------------------------------------------------------------------- 1 | This is about BYTE's beta version of the native-algorithm benchmark 2 | 3 | December 16, 1996: 4 | 5 | The source for DOS is obtainable at http://www.byte.com/bmark/bmark.htm 6 | Linux adaptation written by Uwe F. Mayer 7 | 8 | February 7, 1997: 9 | 10 | added -DSOLARIS flag to support solaris 11 | 12 | November 11, 1997: 13 | 14 | added index split suggested by Andrew D. Balsa 15 | re-baselined to a Linux machine 16 | added checking of CPU-type at run-time (cpuinfo.c) 17 | increased maximal number of loops in some tests 18 | removed -DSOLARIS flag, works now automatically (this also removed the 19 | compiler warnings about redefined types and leads to a 20% faster 20 | code for "Bitfield" if compiled with -funroll-loops!) 21 | 22 | November 13-19, 1997: 23 | 24 | changed debugging information 25 | changed random number generator to be always 32 bits even on 64 bit OSs 26 | added data resets to Bitfield and Huffman 27 | created this Changes file 28 | added debug code for Bitfield 29 | 30 | December 6, 1997: 31 | 32 | got rid of cpuinfo.c 33 | added a RESULTS file 34 | 35 | December 7, 1997: 36 | 37 | fixed the statistical analysis used to compute the confidence coefficient 38 | fixed a bug in the DEBUG routine of "Assignment" 39 | 40 | December 11, 1997 41 | added some entries to RESULTS 42 | 43 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/README.motorola: -------------------------------------------------------------------------------- 1 | The information in this file is old and no longer valid. It seems that 2 | the GNU C library has caught up with Motorola's libmoto, and now 3 | performance is just as good (or better) without libmoto. I'll include 4 | the old notice out of historical reasons only. Currently libmoto is 5 | available at ftp://ftp.mcg.mot.com/pub/SPS/PowerPC/software/mklinux/libmoto/, 6 | but this is subject to change and not under my control. 7 | 8 | February 18, 2003 9 | Uwe F. Mayer 10 | 11 | --------------------------------------------------------------------------- 12 | 13 | If you have a Motorola CPU or equivalent: 14 | 15 | When linked with the 'libmoto' (floating point library from Motorola) 16 | the results you obtain are much better. (FPU index of 0.896 versus 17 | 1.910 in one example.) 18 | 19 | The Motorola math library is currently available at: 20 | http://www.mot.com/SPS/PowerPC/support/rsw_customer_support/mklinux/libmoto/libmoto_reg_mkdev.html 21 | 22 | If you have a Motorola CPU and you submit a result then please let me 23 | know whether you used libmoto or not. Please read the file README.submit. 24 | 25 | I do not have a Motorola CPU, and I can't help you with installing the 26 | library either. 27 | 28 | December 3, 1997 29 | Uwe F. Mayer -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/README.nonlinux: -------------------------------------------------------------------------------- 1 | December 3, 1993 2 | ================ 3 | 4 | DEC Unix 4.0 or DEC OSF1 and gcc 5 | -------------------------------- 6 | Compiles cleanly if you don't use -funroll-loops with gcc-2.7.2.3 or earlier 7 | 8 | DEC UNIX 4.0 or DEC OSF1 and cc 9 | ------------------------------- 10 | CC = cc 11 | CFLAGS = -O3 12 | LINKFLAGS = -s -non_shared 13 | 14 | Compiles cleanly. 15 | 16 | SunOS and gcc 17 | ------------- 18 | Compiles cleanly 19 | 20 | SunOS and cc 21 | ------------ 22 | CC = cc 23 | CFLAGS = -O3 -s 24 | 25 | Compiles with one warning during compilation of nbench1.c 26 | 27 | "/usr/ucbinclude/strings.h", line 48: warning: identifier redeclared: strlen 28 | current : function() returning int 29 | previous: function() returning uint : "/usr/include/string.h", line 98 30 | 31 | HP-UX and gcc 32 | ------------- 33 | Compiles with one warning during compilation of sysspec.c 34 | 35 | In file included from /usr/local/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2.1/include/malloc.h:9, 36 | from sysspec.h:37, 37 | from sysspec.c:37: 38 | /usr/local/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2.1/include/sys/types.h:117: warning: empty declaration 39 | /usr/local/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2.1/include/sys/types.h:118: warning: empty declaration 40 | 41 | DEC Ultrix and cc 42 | ----------------- 43 | CC = cc 44 | CFLAGS = -O2 45 | LINKFLAGS = -s 46 | 47 | Compiles with a warning about the correct usage of cut when running sysinfo.sh 48 | cut: Usage: cut [-s] [-d] {-c | -f} file ... 49 | cut: Usage: cut [-s] [-d] {-c | -f} file ... 50 | 51 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/README.submit: -------------------------------------------------------------------------------- 1 | I plan on posting a digest of results in case people mail me any. 2 | The URL will be linked to 3 | 4 | http://www.tux.org/~mayer/linux/bmark.html 5 | 6 | If you want to submit, then run the benchmark (use your own 7 | compilation, I don't care with what flags or compiler, but I want all 8 | numbers from a single benchmark run) and fill in the template as given 9 | in the example below: 10 | 11 | CPU : AMD 5x86P75 (486DX4/133MHz) 12 | L2 CACHE : 256 KB 13 | OS : Linux 2.0.32 14 | C COMPILER : gcc 2.7.2.3 15 | LIBC : libc-5.4.38 16 | Pentium 90 INTEGER INDEX : 1.051 17 | Pentium 90 FLOATING-POINT INDEX : 0.450 18 | AMD K6/233 MEMORY INDEX : 0.337 19 | AMD K6/233 INTEGER INDEX : 0.238 20 | AMD K6/233 FLOATING-POINT INDEX : 0.230 21 | 22 | Any other format is fine as long as it contains the same info (write 23 | "unknown" or "?" for data you don't know). For example, you could just 24 | cut the summary from the output of nbench and mail it together with 25 | cache, CPU, and OS info in case it is not already present. Please do 26 | not email me the complete output of nbench, or any other unnecessarily 27 | long email, as this just eats up my hard-disk space. However, long 28 | collections of results are of course welcome. 29 | 30 | Send your result to mayer@tux.org 31 | 32 | Uwe F. Mayer 33 | February 18, 2003 34 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/debugbit.good.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RTEMS/rtems-examples/47e727d3d32b806326bfa365b900f7ae72a53ea8/benchmarks/nbench/nbench-byte-2.2.3/debugbit.good.gz -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/hardware.h: -------------------------------------------------------------------------------- 1 | extern 2 | void hardware(const int write_to_file, FILE *global_ofile); 3 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main () {printf("hello.\n");return(0);} 3 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** misc.h 3 | ** Header for misc.c 4 | ** BYTEmark (tm) 5 | ** BYTE's Native Mode Benchmarks 6 | ** Rick Grehan, BYTE Magazine 7 | ** 8 | ** Creation: 9 | ** Revision: 3/95 10 | ** 11 | ** DISCLAIMER 12 | ** The source, executable, and documentation files that comprise 13 | ** the BYTEmark benchmarks are made available on an "as is" basis. 14 | ** This means that we at BYTE Magazine have made every reasonable 15 | ** effort to verify that the there are no errors in the source and 16 | ** executable code. We cannot, however, guarantee that the programs 17 | ** are error-free. Consequently, McGraw-HIll and BYTE Magazine make 18 | ** no claims in regard to the fitness of the source code, executable 19 | ** code, and documentation of the BYTEmark. 20 | ** Furthermore, BYTE Magazine, McGraw-Hill, and all employees 21 | ** of McGraw-Hill cannot be held responsible for any damages resulting 22 | ** from the use of this code or the results obtained from using 23 | ** this code. 24 | */ 25 | 26 | /************************ 27 | ** FUNCTION PROTOTYPES ** 28 | ************************/ 29 | 30 | /* 31 | long randwc(long num); 32 | unsigned long abs_randwc(unsigned long num); 33 | long randnum(long lngval); 34 | */ 35 | 36 | #include "nmglobal.h" 37 | int32 randwc(int32 num); 38 | u32 abs_randwc(u32 num); 39 | int32 randnum(int32 lngval); 40 | 41 | 42 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | printf("%d",(int)sizeof(long)); 4 | return(0); 5 | } 6 | 7 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/pointer.h: -------------------------------------------------------------------------------- 1 | //#define LONG64 2 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/sysinfo.c: -------------------------------------------------------------------------------- 1 | sprintf(buffer,"**System used for compilation:\n"); 2 | output_string(buffer); 3 | sprintf(buffer,"**Linux rokka-laptop 2.6.32-29-generic #58-Ubuntu SMP Fri Feb 11 20:52:10 UTC 20\n"); 4 | output_string(buffer); 5 | sprintf(buffer,"**C compiler: gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) \n"); 6 | output_string(buffer); 7 | sprintf(buffer,"**libc: \n"); 8 | output_string(buffer); 9 | sprintf(buffer,"**Date of compilation: Wed Mar 16 02:20:48 EET 2011\n"); 10 | output_string(buffer); 11 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/sysinfo.c.example: -------------------------------------------------------------------------------- 1 | sprintf(buffer,"**System used for compilation:\n"); 2 | output_string(buffer); 3 | sprintf(buffer,"**Linux mimi 2.0.31 #5 Thu Oct 23 10:02:08 CDT 1997 i486\n"); 4 | output_string(buffer); 5 | sprintf(buffer,"**C compiler: gcc version 2.7.2.3\n"); 6 | output_string(buffer); 7 | sprintf(buffer,"**libc: libc.so.5.4.38\n"); 8 | output_string(buffer); 9 | sprintf(buffer,"**Date of compilation: Thu Nov 20 10:04:43 CST 1997\n"); 10 | output_string(buffer); 11 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/sysinfo.c.template: -------------------------------------------------------------------------------- 1 | sprintf(buffer,"**System used for compilation:\n"); 2 | output_string(buffer); 3 | sprintf(buffer,"**%SYSTEM%\n"); 4 | output_string(buffer); 5 | sprintf(buffer,"**C compiler: %CCVERSION%\n"); 6 | output_string(buffer); 7 | sprintf(buffer,"**libc: %LIBCVERSION%\n"); 8 | output_string(buffer); 9 | sprintf(buffer,"**Date of compilation: %DATE%\n"); 10 | output_string(buffer); 11 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/sysinfoc.c: -------------------------------------------------------------------------------- 1 | sprintf(buffer,"C compiler : gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) \n"); 2 | output_string(buffer); 3 | sprintf(buffer,"libc : \n"); 4 | output_string(buffer); 5 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/sysinfoc.c.example: -------------------------------------------------------------------------------- 1 | sprintf(buffer,"C compiler : gcc version 2.7.2.3\n"); 2 | output_string(buffer); 3 | sprintf(buffer,"libc : libc.so.5.4.38\n"); 4 | output_string(buffer); 5 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/sysinfoc.c.template: -------------------------------------------------------------------------------- 1 | sprintf(buffer,"C compiler : %CCVERSION%\n"); 2 | output_string(buffer); 3 | sprintf(buffer,"libc : %LIBCVERSION%\n"); 4 | output_string(buffer); 5 | -------------------------------------------------------------------------------- /benchmarks/nbench/nbench-byte-2.2.3/wordcat.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** wordcat.h 3 | ** Word catalog 4 | ** BYTEmark (tm) 5 | ** BYTE's Native Mode Benchmarks 6 | ** Rick Grehan, BYTE Magazine 7 | ** 8 | ** Creation: 9 | ** Revision: 3/95 10 | ** 11 | ** DISCLAIMER 12 | ** The source, executable, and documentation files that comprise 13 | ** the BYTEmark benchmarks are made available on an "as is" basis. 14 | ** This means that we at BYTE Magazine have made every reasonable 15 | ** effort to verify that the there are no errors in the source and 16 | ** executable code. We cannot, however, guarantee that the programs 17 | ** are error-free. Consequently, McGraw-HIll and BYTE Magazine make 18 | ** no claims in regard to the fitness of the source code, executable 19 | ** code, and documentation of the BYTEmark. 20 | ** Furthermore, BYTE Magazine, McGraw-Hill, and all employees 21 | ** of McGraw-Hill cannot be held responsible for any damages resulting 22 | ** from the use of this code or the results obtained from using 23 | ** this code. 24 | */ 25 | 26 | /* 27 | ** Word catalog 28 | */ 29 | #define WORDCATSIZE 50 30 | 31 | char *wordcatarray[WORDCATSIZE] = 32 | { "Hello", 33 | "He", 34 | "Him", 35 | "the", 36 | "this", 37 | "that", 38 | "though", 39 | "rough", 40 | "cough", 41 | "obviously", 42 | "But", 43 | "but", 44 | "bye", 45 | "begin", 46 | "beginning", 47 | "beginnings", 48 | "of", 49 | "our", 50 | "ourselves", 51 | "yourselves", 52 | "to", 53 | "together", 54 | "togetherness", 55 | "from", 56 | "either", 57 | "I", 58 | "A", 59 | "return", 60 | "However", 61 | "that", 62 | "example", 63 | "yet", 64 | "quickly", 65 | "all", 66 | "if", 67 | "were", 68 | "includes", 69 | "always", 70 | "never", 71 | "not", 72 | "small", 73 | "returns", 74 | "set", 75 | "basic", 76 | "Entered", 77 | "with", 78 | "used", 79 | "shown", 80 | "you", 81 | "know" }; 82 | -------------------------------------------------------------------------------- /benchmarks/nbench/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | 10 | path = 'nbench-byte-2.2.3/' 11 | 12 | bld(features = 'c cprogram', 13 | target = 'nbench.exe', 14 | source = ['main.c', path + 'emfloat.c', path + 'hardware.c', 15 | path + 'misc.c', path + 'nbench0.c', path + 'nbench1.c', 16 | path + 'sysspec.c'], 17 | lib = ['m']) 18 | -------------------------------------------------------------------------------- /benchmarks/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('nbench') 10 | 11 | -------------------------------------------------------------------------------- /c11/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains a set of examples of using the entire 2 | C11 API. 3 | 4 | c11_thread01 - multiple threads, arguments, yield, sleep 5 | c11_mutex01 - mutual exclusion, blocking, timeout 6 | c11_cndvar01 - use condition variable to signal data arrival 7 | c11_key01 - per thread storage 8 | -------------------------------------------------------------------------------- /c11/c11_cndvar01/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/c11_cndvar01.exe 6 | 7 | # C source names 8 | CSRCS = rtems_config.c test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /c11/c11_cndvar01/rtems_config.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief RTEMS Configuration for C11 Mutex Example 3 | */ 4 | 5 | /* 6 | * This file's license is 2-clause BSD as in this distribution's 7 | * LICENSE.2 file. 8 | */ 9 | 10 | #include 11 | 12 | int main(int argc, char **argv); 13 | 14 | static char *argv_list[] = { 15 | "c11-cndvar01", 16 | "" 17 | }; 18 | 19 | static void *POSIX_Init(void *arg) 20 | { 21 | int rc; 22 | 23 | (void) arg; /* deliberately ignored */ 24 | 25 | /* 26 | * Initialize optional services 27 | */ 28 | 29 | /* 30 | * Could get arguments from command line or have a static set. 31 | */ 32 | rc = main(1, argv_list); 33 | 34 | exit(rc); 35 | return NULL; 36 | } 37 | 38 | #include /* for device driver prototypes */ 39 | 40 | /* NOTICE: the clock driver is explicitly disabled */ 41 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 42 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 43 | 44 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 45 | 46 | #define CONFIGURE_UNLIMITED_OBJECTS 47 | #define CONFIGURE_UNIFIED_WORK_AREAS 48 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32 49 | 50 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 51 | 52 | #define CONFIGURE_INIT 53 | #include 54 | -------------------------------------------------------------------------------- /c11/c11_cndvar01/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Joel Sherrill (joel.sherrill@oarcorp.com) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'c11_cndvar01.exe', 14 | source = ['rtems_config.c', 'test.c']) 15 | -------------------------------------------------------------------------------- /c11/c11_key01/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/c11_key01.exe 6 | 7 | # C source names 8 | CSRCS = rtems_config.c test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /c11/c11_key01/rtems_config.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief RTEMS Configuration for C11 Threads Example 3 | */ 4 | 5 | /* 6 | * This file's license is 2-clause BSD as in this distribution's 7 | * LICENSE.2 file. 8 | */ 9 | 10 | #include 11 | 12 | int main(int argc, char **argv); 13 | 14 | static char *argv_list[] = { 15 | "c11-key01", 16 | "" 17 | }; 18 | 19 | static void *POSIX_Init(void *arg) 20 | { 21 | int rc; 22 | 23 | (void) arg; /* deliberately ignored */ 24 | 25 | /* 26 | * Initialize optional services 27 | */ 28 | 29 | /* 30 | * Could get arguments from command line or have a static set. 31 | */ 32 | rc = main(1, argv_list); 33 | 34 | exit(rc); 35 | return NULL; 36 | } 37 | 38 | #include /* for device driver prototypes */ 39 | 40 | /* NOTICE: the clock driver is explicitly disabled */ 41 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 42 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 43 | 44 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 45 | 46 | #define CONFIGURE_UNLIMITED_OBJECTS 47 | #define CONFIGURE_UNIFIED_WORK_AREAS 48 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32 49 | 50 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 51 | 52 | #define CONFIGURE_INIT 53 | #include 54 | -------------------------------------------------------------------------------- /c11/c11_key01/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Joel Sherrill (joel.sherrill@oarcorp.com) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'c11_key01.exe', 14 | source = ['rtems_config.c', 'test.c']) 15 | -------------------------------------------------------------------------------- /c11/c11_mutex01/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/c11_mutex01.exe 6 | 7 | # C source names 8 | CSRCS = rtems_config.c test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /c11/c11_mutex01/rtems_config.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief RTEMS Configuration for C11 Mutex Example 3 | */ 4 | 5 | /* 6 | * This file's license is 2-clause BSD as in this distribution's 7 | * LICENSE.2 file. 8 | */ 9 | 10 | #include 11 | 12 | int main(int argc, char **argv); 13 | 14 | static char *argv_list[] = { 15 | "c11-mutex01", 16 | "" 17 | }; 18 | 19 | static void *POSIX_Init(void *arg) 20 | { 21 | int rc; 22 | 23 | (void) arg; /* deliberately ignored */ 24 | 25 | /* 26 | * Initialize optional services 27 | */ 28 | 29 | /* 30 | * Could get arguments from command line or have a static set. 31 | */ 32 | rc = main(1, argv_list); 33 | 34 | exit(rc); 35 | return NULL; 36 | } 37 | 38 | #include /* for device driver prototypes */ 39 | 40 | /* NOTICE: the clock driver is explicitly disabled */ 41 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 42 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 43 | 44 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 45 | 46 | #define CONFIGURE_UNLIMITED_OBJECTS 47 | #define CONFIGURE_UNIFIED_WORK_AREAS 48 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32 49 | 50 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 51 | 52 | #define CONFIGURE_INIT 53 | #include 54 | -------------------------------------------------------------------------------- /c11/c11_mutex01/test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief C11 Threads Example 3 | */ 4 | 5 | /* 6 | * This file's license is 2-clause BSD as in this distribution's 7 | * LICENSE.2 file. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | static thrd_t thread1; 16 | static mtx_t mutex1; 17 | 18 | int Thread1_Body(void *arg) 19 | { 20 | int rc; 21 | struct timespec delay; 22 | 23 | (void) arg; 24 | 25 | puts("Thread1 - mtx_trylock(mutex1) -> thrd_busy"); 26 | rc = mtx_trylock(&mutex1); 27 | assert(rc == thrd_busy); 28 | 29 | puts("Thread1 - mtx_timedlock(mutex1, 2 second) - thrd_timeout"); 30 | delay.tv_sec = time(NULL) + 1; 31 | delay.tv_nsec = 0; 32 | rc = mtx_timedlock(&mutex1, &delay); 33 | assert(rc == thrd_timedout); 34 | 35 | puts("Thread1 - mtx_lock(mutex1)"); 36 | rc = mtx_lock(&mutex1); 37 | assert(rc == thrd_success); 38 | 39 | puts("Thread1 - yield" ); 40 | thrd_yield(); 41 | 42 | puts("Thread1 - exit" ); 43 | thrd_exit(0); 44 | return 0; 45 | } 46 | 47 | int main(int argc, char **argv) 48 | { 49 | int rc; 50 | struct timespec delay = {5, 0}; 51 | 52 | puts("*** START OF C11 MUTEX EXAMPLE ***"); 53 | 54 | puts("main - Create Thread1"); 55 | rc = thrd_create(&thread1, Thread1_Body, &thread1); 56 | assert(rc == thrd_success); 57 | 58 | puts("main - mtx_init(mutex1)"); 59 | rc = mtx_init(&mutex1, mtx_timed); 60 | assert(rc == thrd_success); 61 | 62 | puts("main - mtx_lock(mutex1)"); 63 | rc = mtx_lock(&mutex1); 64 | assert(rc == thrd_success); 65 | 66 | puts("main - yield to Thread1" ); 67 | thrd_yield(); 68 | 69 | puts("main - sleep to let Thread2's delay complete while locked"); 70 | rc = thrd_sleep(&delay, NULL); 71 | assert(rc == 0); 72 | 73 | puts("main - mtx_unlock(mutex1)" ); 74 | rc = mtx_unlock(&mutex1); 75 | assert(rc == thrd_success); 76 | 77 | puts("main - yield to Thread1" ); 78 | thrd_yield(); 79 | 80 | puts("main - mtx_destroy(mutex1)" ); 81 | mtx_destroy(&mutex1); 82 | 83 | puts("*** END OF C11 MUTEX EXAMPLE ***"); 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /c11/c11_mutex01/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Joel Sherrill (joel.sherrill@oarcorp.com) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'c11_mutex01.exe', 14 | source = ['rtems_config.c', 'test.c']) 15 | -------------------------------------------------------------------------------- /c11/c11_thread01/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/c11_thread01.exe 6 | 7 | # C source names 8 | CSRCS = rtems_config.c test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /c11/c11_thread01/rtems_config.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief RTEMS Configuration for C11 Threads Example 3 | */ 4 | 5 | /* 6 | * This file's license is 2-clause BSD as in this distribution's 7 | * LICENSE.2 file. 8 | */ 9 | 10 | #include 11 | 12 | int main(int argc, char **argv); 13 | 14 | static char *argv_list[] = { 15 | "c11-thread01", 16 | "" 17 | }; 18 | 19 | static void *POSIX_Init(void *arg) 20 | { 21 | int rc; 22 | 23 | (void) arg; /* deliberately ignored */ 24 | 25 | /* 26 | * Initialize optional services 27 | */ 28 | 29 | /* 30 | * Could get arguments from command line or have a static set. 31 | */ 32 | rc = main(1, argv_list); 33 | 34 | exit(rc); 35 | return NULL; 36 | } 37 | 38 | #include /* for device driver prototypes */ 39 | 40 | /* NOTICE: the clock driver is explicitly disabled */ 41 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 42 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 43 | 44 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 45 | 46 | #define CONFIGURE_UNLIMITED_OBJECTS 47 | #define CONFIGURE_UNIFIED_WORK_AREAS 48 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32 49 | 50 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 51 | 52 | #define CONFIGURE_INIT 53 | #include 54 | -------------------------------------------------------------------------------- /c11/c11_thread01/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Joel Sherrill (joel.sherrill@oarcorp.com) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'c11_thread01.exe', 14 | source = ['rtems_config.c', 'test.c']) 15 | -------------------------------------------------------------------------------- /c11/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('c11_thread01 ') 10 | bld.recurse('c11_mutex01 ') 11 | bld.recurse('c11_cndvar01 ') 12 | bld.recurse('c11_key01 ') 13 | -------------------------------------------------------------------------------- /classic_api/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS=classic_signal triple_period 6 | -------------------------------------------------------------------------------- /classic_api/classic_signal/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/classic_signal.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /classic_api/classic_signal/wscript: -------------------------------------------------------------------------------- 1 | # Waf build script for an RTEMS classic_signal' 2 | import rtems_waf.rtems as rtems 3 | 4 | def build(bld): 5 | rtems.build(bld) 6 | 7 | bld(features = 'c cprogram', 8 | target = 'classic_signal.exe', 9 | source = ['test.c']) 10 | -------------------------------------------------------------------------------- /classic_api/triple_period/Makefile: -------------------------------------------------------------------------------- 1 | PGM=${ARCH}/triple_period.exe 2 | 3 | # C source names, if any, go here -- minus the .c 4 | CSRCS = init.c tasks.c 5 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 6 | 7 | H_FILES=system.h 8 | 9 | OBJS=$(COBJS) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | all: ${ARCH} $(PGM) 16 | 17 | ${PGM}: ${OBJS} 18 | $(make-exe) 19 | -------------------------------------------------------------------------------- /classic_api/triple_period/wscript: -------------------------------------------------------------------------------- 1 | # Waf build script for an RTEMS triple_period 2 | import rtems_waf.rtems as rtems 3 | 4 | def build(bld): 5 | rtems.build(bld) 6 | 7 | bld(features = 'c cprogram', 8 | target = 'triple_period.exe', 9 | source = ['init.c', 'tasks.c']) 10 | -------------------------------------------------------------------------------- /classic_api/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('classic_signal') 10 | bld.recurse('triple_period') 11 | -------------------------------------------------------------------------------- /cxx/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | # These tests require C++ 6 | ifneq ($(CXX_FOR_TARGET),) 7 | SUBDIRS = cxx_throw 8 | SUBDIRS += cxx_stdmap 9 | 10 | # This is specific to application Makefile support 11 | SUBDIRS += libcpp 12 | endif 13 | -------------------------------------------------------------------------------- /cxx/cxx_stdmap/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | EXEC=cxx_stdmap.exe 10 | PGM=${ARCH}/$(EXEC) 11 | 12 | # C source names 13 | CSRCS = rtems_config.c 14 | COBJS_ = $(CSRCS:.c=.o) 15 | COBJS = $(COBJS_:%=${ARCH}/%) 16 | 17 | # C++ source names 18 | CXXSRCS = main.cc 19 | CXXOBJS_ = $(CXXSRCS:.cc=.o) 20 | CXXOBJS = $(CXXOBJS_:%=${ARCH}/%) 21 | 22 | # AS source names 23 | ASSRCS = 24 | ASOBJS_ = $(ASSRCS:.s=.o) 25 | ASOBJS = $(ASOBJS_:%=${ARCH}/%) 26 | 27 | # Libraries 28 | LIBS = 29 | 30 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 31 | 32 | include $(RTEMS_CUSTOM) 33 | include $(PROJECT_ROOT)/make/leaf.cfg 34 | 35 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 36 | 37 | all: ${ARCH} $(PGM) 38 | 39 | $(PGM): $(OBJS) 40 | $(make-cxx-exe) 41 | 42 | -------------------------------------------------------------------------------- /cxx/cxx_stdmap/main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main() { 8 | 9 | // Creating & Initializing a map of String & Ints 10 | std::map mapOfWordCount = { { "aaa", 10 }, { "ddd", 41 }, 11 | { "bbb", 62 }, { "ccc", 13 } }; 12 | 13 | // Declaring the type of Predicate that accepts 2 pairs and return a bool 14 | typedef std::function, std::pair)> Comparator; 15 | 16 | // Defining a lambda function to compare two pairs. It will compare two pairs using second field 17 | Comparator compFunctor = 18 | [](std::pair elem1 ,std::pair elem2) 19 | { 20 | return elem1.second < elem2.second; 21 | }; 22 | 23 | // Declaring a set that will store the pairs using above comparision logic 24 | std::set, Comparator> setOfWords( 25 | mapOfWordCount.begin(), mapOfWordCount.end(), compFunctor); 26 | 27 | // Iterate over a set using range base for loop 28 | // It will display the items in sorted order of values 29 | for (std::pair element : setOfWords) 30 | std::cout << element.first << " :: " << element.second << std::endl; 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /cxx/cxx_stdmap/rtems_config.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main(int argc, char **argv); 5 | 6 | static char *argv_list[] = { 7 | "cxx_stdmap", 8 | "" 9 | }; 10 | 11 | 12 | static void *POSIX_Init(void *arg) 13 | { 14 | (void) arg; /* deliberately ignored */ 15 | 16 | /* 17 | * Initialize optional services 18 | */ 19 | 20 | /* 21 | * Could get arguments from command line or have a static set. 22 | */ 23 | (void) main(1, argv_list); 24 | 25 | exit(0); 26 | 27 | return NULL; 28 | } 29 | 30 | #include /* for device driver prototypes */ 31 | 32 | /* NOTICE: the clock driver is explicitly disabled */ 33 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 34 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 35 | 36 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 37 | 38 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 39 | 40 | #define CONFIGURE_UNLIMITED_OBJECTS 41 | #define CONFIGURE_UNIFIED_WORK_AREAS 42 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32 43 | 44 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 45 | 46 | #define CONFIGURE_INIT 47 | #include 48 | -------------------------------------------------------------------------------- /cxx/cxx_stdmap/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for std::map RTEMS example 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'cxx cxxprogram', 13 | target = 'cxx_stdmap.exe', 14 | source = ['main.cc', 'rtems_config.c']) 15 | -------------------------------------------------------------------------------- /cxx/cxx_throw/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | EXEC=cxx_throw.exe 10 | PGM=${ARCH}/$(EXEC) 11 | 12 | # C source names 13 | CSRCS = 14 | COBJS_ = $(CSRCS:.c=.o) 15 | COBJS = $(COBJS_:%=${ARCH}/%) 16 | 17 | # C++ source names 18 | CXXSRCS = init.cc 19 | CXXOBJS_ = $(CXXSRCS:.cc=.o) 20 | CXXOBJS = $(CXXOBJS_:%=${ARCH}/%) 21 | 22 | # AS source names 23 | ASSRCS = 24 | ASOBJS_ = $(ASSRCS:.s=.o) 25 | ASOBJS = $(ASOBJS_:%=${ARCH}/%) 26 | 27 | # Libraries 28 | LIBS = 29 | 30 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 31 | 32 | include $(RTEMS_CUSTOM) 33 | include $(PROJECT_ROOT)/make/leaf.cfg 34 | 35 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 36 | 37 | all: ${ARCH} $(PGM) 38 | 39 | $(PGM): $(OBJS) 40 | $(make-cxx-exe) 41 | 42 | -------------------------------------------------------------------------------- /cxx/cxx_throw/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for C++ Throw example 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'cxx cxxprogram', 13 | target = 'cxx_throw.exe', 14 | source = ['init.cc']) 15 | 16 | -------------------------------------------------------------------------------- /cxx/libcpp/Makefile: -------------------------------------------------------------------------------- 1 | # Templates/Makefile.lib 2 | # adapted for an external library 3 | # 4 | 5 | LIBNAME=libfoo.a # xxx- your library names goes here 6 | LIB=${ARCH}/${LIBNAME} 7 | 8 | # C and C++ source names, if any, go here -- minus the .c or .cc 9 | C_FILES= 10 | C_O_FILES=$(C_FILES:%.c=${ARCH}/%.o) 11 | 12 | CC_FILES=foo.cc 13 | CC_O_FILES=$(CC_FILES:%.cc=${ARCH}/%.o) 14 | 15 | CPP_FILES=foo1.cpp 16 | CPP_O_FILES=$(CPP_FILES:%.cpp=${ARCH}/%.o) 17 | 18 | H_FILES=foo.h 19 | 20 | SRCS=$(C_FILES) $(CC_FILES) $(CPP_FILES) $(H_FILES) 21 | OBJS=$(C_O_FILES) $(CC_O_FILES) $(CPP_O_FILES) 22 | 23 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 24 | include $(RTEMS_CUSTOM) 25 | include $(RTEMS_SHARE)/make/lib.cfg 26 | 27 | # 28 | # Extra rules for other variations on C++ file name extensions 29 | # 30 | 31 | COMPILE.cpp=$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c 32 | 33 | ${ARCH}/%.o: %.cpp 34 | ${COMPILE.cc} -o $@ $< 35 | 36 | # 37 | # Add local stuff here using += 38 | # 39 | 40 | DEFINES += 41 | CPPFLAGS += 42 | CFLAGS += 43 | 44 | # 45 | # Add your list of files to delete here. The config files 46 | # already know how to delete some stuff, so you may want 47 | # to just run 'make clean' first to see what gets missed. 48 | # 'make clobber' already includes 'make clean' 49 | # 50 | CLEAN_ADDITIONS += 51 | CLOBBER_ADDITIONS += 52 | 53 | all: ${ARCH} $(SRCS) $(LIB) 54 | 55 | $(LIB): ${OBJS} 56 | $(make-library) 57 | 58 | # Install the library, appending _g or _p as appropriate. 59 | # for include files, just use $(INSTALL) 60 | install: all 61 | # $(INSTALL_VARIANT) -m 644 ${LIB} ${PROJECT_RELEASE}/lib 62 | -------------------------------------------------------------------------------- /cxx/libcpp/README: -------------------------------------------------------------------------------- 1 | Example C++ library submitted by Ralf Corsepius . 2 | 3 | The C++ is just place holders to illustrate the Makefile mechanics needed. 4 | -------------------------------------------------------------------------------- /cxx/libcpp/foo.cc: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | 4 | #include "foo.h" 5 | 6 | std::ostream& operator << ( std::ostream & strm, const foo &f) 7 | { 8 | strm << f.i; 9 | return strm; 10 | } 11 | -------------------------------------------------------------------------------- /cxx/libcpp/foo.h: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | 4 | #ifndef _foo_h 5 | #define _foo_h 6 | 7 | #include 8 | 9 | class foo { 10 | public : 11 | int i ; 12 | 13 | foo() : i(0) {} ; 14 | foo( const int i0 ) : i(i0) {}; 15 | 16 | friend std::ostream& operator << (std::ostream&,const foo&); 17 | friend std::ostream& operator << (std::ostream&,const foo*); 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /cxx/libcpp/foo1.cpp: -------------------------------------------------------------------------------- 1 | #include "foo.h" 2 | 3 | std::ostream& operator << ( std::ostream & strm, const foo *f ) 4 | { 5 | strm << f->i; 6 | return strm; 7 | } 8 | -------------------------------------------------------------------------------- /cxx/libcpp/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'cxx cxxstlib', 13 | target = 'foo.exe', 14 | source = ['foo.cc', 'foo1.cpp']) 15 | 16 | -------------------------------------------------------------------------------- /cxx/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | # These tests require C++ 10 | if bld.env['CXX'] is not None: 11 | bld.recurse('libcpp') 12 | bld.recurse('cxx_throw') 13 | bld.recurse('cxx_stdmap') 14 | 15 | -------------------------------------------------------------------------------- /file_io/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS = fdopen filerdback repeated_opens crc 6 | -------------------------------------------------------------------------------- /file_io/crc/.gitignore: -------------------------------------------------------------------------------- 1 | fs-root-tar 2 | fs-root-tar.c 3 | fs-root-tar.h 4 | stamp-fs-image 5 | 6 | -------------------------------------------------------------------------------- /file_io/crc/LICENSE: -------------------------------------------------------------------------------- 1 | The CRC32 code is from http://www.snippets.org/. This is the following files: 2 | 3 | crc_32.c 4 | crc.h 5 | sniptype.h 6 | 7 | This code is FREE with no restrictions. 8 | -------------------------------------------------------------------------------- /file_io/crc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/crc.exe 6 | 7 | # C source names 8 | CSRCS = crc_32.c init.c fs-root-tar.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | CLEAN_ADDITIONS += stamp-fs-image 12 | CLEAN_ADDITIONS += fs-root-tar fs-root-tar.c fs-root-tar.h 13 | 14 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 15 | include $(RTEMS_CUSTOM) 16 | include $(PROJECT_ROOT)/make/leaf.cfg 17 | 18 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 19 | 20 | all: ${ARCH} $(OBJS) $(PGM) 21 | 22 | $(ARCH)/init.o: init.c stamp-fs-image 23 | 24 | $(ARCH)/fs-root-tar.o: stamp-fs-image fs-root-tar.c fs-root-tar.h 25 | 26 | fs-root-tar: $(ARCH) rootfs/image.img 27 | cd rootfs ; \ 28 | tar cf ../fs-root-tar --exclude CVS --exclude .cvsignore . 29 | 30 | stamp-fs-image: $(ARCH) fs-root-tar 31 | rtems-bin2c fs-root-tar fs-root-tar 32 | ls -l fs-root-tar* 33 | touch stamp-fs-image 34 | 35 | $(PGM): $(OBJS) 36 | $(make-exe) 37 | -------------------------------------------------------------------------------- /file_io/crc/README: -------------------------------------------------------------------------------- 1 | This is a simple example which illustrates how to use the 2 | In-Memory File System (IMFS) in conjunction with "untar" to 3 | load the initial contents. 4 | 5 | Thanks to Gedare Bloom for the code this is based upon. 6 | -------------------------------------------------------------------------------- /file_io/crc/crc.h: -------------------------------------------------------------------------------- 1 | /* +++Date last modified: 05-Jul-1997 */ 2 | 3 | /* 4 | ** CRC.H - header file for SNIPPETS CRC and checksum functions 5 | */ 6 | 7 | #ifndef CRC__H 8 | #define CRC__H 9 | 10 | #include /* For size_t */ 11 | #include "sniptype.h" /* For BYTE, WORD, DWORD */ 12 | 13 | /* 14 | ** File: ARCCRC16.C 15 | */ 16 | 17 | void init_crc_table(void); 18 | WORD crc_calc(WORD crc, char *buf, unsigned nbytes); 19 | void do_file(char *fn); 20 | 21 | /* 22 | ** File: CRC-16.C 23 | */ 24 | 25 | WORD crc16(char *data_p, WORD length); 26 | 27 | /* 28 | ** File: CRC-16F.C 29 | */ 30 | 31 | WORD updcrc(WORD icrc, BYTE *icp, size_t icnt); 32 | 33 | /* 34 | ** File: CRC_32.C 35 | */ 36 | 37 | #define UPDC32(octet,crc) (crc_32_tab[((crc)^((BYTE)octet)) & 0xff] ^ ((crc) >> 8)) 38 | 39 | DWORD updateCRC32(unsigned char ch, DWORD crc); 40 | Boolean_T crc32file(char *name, DWORD *crc, long *charcnt); 41 | DWORD crc32buf(char *buf, size_t len); 42 | 43 | /* 44 | ** File: CHECKSUM.C 45 | */ 46 | 47 | unsigned checksum(void *buffer, size_t len, unsigned int seed); 48 | 49 | /* 50 | ** File: CHECKEXE.C 51 | */ 52 | 53 | void checkexe(char *fname); 54 | 55 | 56 | 57 | #endif /* CRC__H */ 58 | -------------------------------------------------------------------------------- /file_io/crc/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2011. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include "fs-root-tar.h" 19 | #include 20 | 21 | /* sha-specific includes */ 22 | #include 23 | #include 24 | #include "crc.h" 25 | #include 26 | 27 | rtems_task Init( 28 | rtems_task_argument ignored 29 | ) 30 | { 31 | char in_file[20] = "/image.img"; 32 | DWORD crc; 33 | long charcnt; 34 | 35 | puts( "\n\n*** untar/imfs/crc example ***" ); 36 | 37 | printf("Unpacking tar filesystem\nThis may take awhile...\n"); 38 | if(Untar_FromMemory((char*) fs_root_tar, fs_root_tar_size) != 0) { 39 | printf("Can't unpack tar filesystem\n"); 40 | exit(1); 41 | } 42 | 43 | crc32file(in_file,&crc, &charcnt); 44 | printf("%08lX %7ld %s\n", crc, charcnt, in_file); 45 | 46 | printf( "*** end of demonstration ***\n" ); 47 | exit( 0 ); 48 | } 49 | 50 | /* configuration */ 51 | /* drivers */ 52 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 53 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 54 | 55 | /* filesystem */ 56 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 57 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 40 58 | #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK 512 59 | 60 | /* tasks */ 61 | #define CONFIGURE_MAXIMUM_TASKS 4 62 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 63 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) 64 | 65 | #define CONFIGURE_INIT 66 | #include 67 | /* end of file */ 68 | -------------------------------------------------------------------------------- /file_io/crc/rootfs/image.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RTEMS/rtems-examples/47e727d3d32b806326bfa365b900f7ae72a53ea8/file_io/crc/rootfs/image.img -------------------------------------------------------------------------------- /file_io/crc/sniptype.h: -------------------------------------------------------------------------------- 1 | /* +++Date last modified: 05-Jul-1997 */ 2 | 3 | /* 4 | ** SNIPTYPE.H - Include file for SNIPPETS data types and commonly used macros 5 | */ 6 | 7 | #ifndef SNIPTYPE__H 8 | #define SNIPTYPE__H 9 | 10 | #include /* For free() */ 11 | #include /* For NULL & strlen() */ 12 | 13 | typedef enum {Error_ = -1, Success_, False_ = 0, True_} Boolean_T; 14 | 15 | /*#if !defined(WIN32) && !defined(_WIN32) && !defined(__NT__) \ 16 | && !defined(_WINDOWS) 17 | #if !defined(OS2)*/ 18 | typedef unsigned char BYTE; 19 | typedef unsigned long DWORD; 20 | /* #endif*/ 21 | typedef unsigned short WORD; 22 | /*#else 23 | #define WIN32_LEAN_AND_MEAN 24 | #define NOGDI 25 | #define NOSERVICE 26 | #undef INC_OLE1 27 | #undef INC_OLE2 28 | #include 29 | #define HUGE 30 | #endif*/ 31 | 32 | #define NUL '\0' 33 | #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) 34 | #define TOBOOL(x) (!(!(x))) 35 | #define FREE(p) (free(p),(p)=NULL) 36 | 37 | #endif /* SNIPTYPE__H */ 38 | -------------------------------------------------------------------------------- /file_io/crc/wscript: -------------------------------------------------------------------------------- 1 | #Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for RTEMS fat_ramdisk 7 | 8 | import rtems_waf.rtems as rtems 9 | import rtems_waf.rootfs as rootfs 10 | 11 | version = "1.0.0" 12 | 13 | def build(bld): 14 | rtems.build(bld) 15 | 16 | arch_bsp = bld.get_env()['RTEMS_ARCH_BSP'] 17 | arch = bld.get_env()['RTEMS_ARCH'] 18 | bsp = bld.get_env()['RTEMS_BSP'] 19 | 20 | # 21 | # The include paths and defines. 22 | # 23 | bld.includes = ['.'] 24 | bld.defines = ['PACKAGE_VERSION="' + version + '"'] 25 | 26 | # 27 | # Package the root file system as a C file. 28 | # 29 | if rtems.check_env(bld, 'RTEMS_BIN2C'): 30 | rootfs.build_from_src_root(bld, 31 | name = 'fs-root', 32 | root = 'rootfs') 33 | 34 | bld.path.find_or_declare('fs-root-tar.h') 35 | 36 | bld(features = 'c cprogram', 37 | target = 'crc.exe', 38 | includes = bld.includes, 39 | defines = bld.defines, 40 | source = ['init.c', 41 | 'fs-root-tar.c', 42 | 'crc_32.c']) 43 | -------------------------------------------------------------------------------- /file_io/fdopen/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | EXEC=test.exe 10 | PGM=${ARCH}/$(EXEC) 11 | 12 | # C source names 13 | CSRCS = test.c 14 | COBJS_ = $(CSRCS:.c=.o) 15 | COBJS = $(COBJS_:%=${ARCH}/%) 16 | 17 | # C++ source names 18 | CXXSRCS = 19 | CXXOBJS_ = $(CXXSRCS:.cc=.o) 20 | CXXOBJS = $(CXXOBJS_:%=${ARCH}/%) 21 | 22 | # AS source names 23 | ASSRCS = 24 | ASOBJS_ = $(ASSRCS:.s=.o) 25 | ASOBJS = $(ASOBJS_:%=${ARCH}/%) 26 | 27 | # Libraries 28 | LIBS = -lrtemsall -lc 29 | 30 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 31 | 32 | include $(RTEMS_CUSTOM) 33 | include $(PROJECT_ROOT)/make/leaf.cfg 34 | 35 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 36 | 37 | all: ${ARCH} $(PGM) 38 | 39 | $(PGM): $(OBJS) 40 | $(make-exe) 41 | 42 | -------------------------------------------------------------------------------- /file_io/fdopen/fdopen.ini: -------------------------------------------------------------------------------- 1 | ; 2 | ; RTEMS Trace Linker Configuration: FD Open 3 | ; 4 | [tracer] 5 | ; 6 | ; Name of the trace. 7 | ; 8 | name = FD Open RTEMS Tracer 9 | ; 10 | ; Options can be defined here or on the command line. 11 | ; 12 | ;options = verbose, verbose 13 | ; 14 | ; Functions to trace. 15 | ; 16 | traces = rtems-score-object-all 17 | traces = rtems-score-thread-all 18 | traces = rtems-score-threadq-all 19 | traces = rtems-score-heap-all 20 | ; 21 | ; Define the function sets. These are the function's that can be 22 | ; added to the trace lists. 23 | ; 24 | functions = rtems-score 25 | ; 26 | ; Include RTEMS Trace support. 27 | ; 28 | include = rtems.ini, rtld-base.ini 29 | -------------------------------------------------------------------------------- /file_io/fdopen/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program -- demonstrating use of IMFS 3 | */ 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | rtems_task Init( 13 | rtems_task_argument ignored 14 | ) 15 | { 16 | int fd; 17 | FILE *fp; 18 | char str[256]; 19 | 20 | /* 21 | * Print a startup message 22 | */ 23 | printf( 24 | "\n\n" 25 | "%s\n" 26 | "Here we go!\n", 27 | rtems_get_version_string() 28 | ); 29 | 30 | fp = fopen("test", "w"); 31 | fprintf(fp, "Hello world!!!\n"); 32 | fclose(fp); 33 | 34 | fp = fopen("test", "r"); 35 | fgets(str, 200, fp); 36 | printf("read: %s\n", str); 37 | fclose(fp); 38 | 39 | fd = open("test", O_WRONLY|O_APPEND); 40 | printf( "fcntl flags =0x%x\n", fcntl( fd, F_GETFL ) ); 41 | close(fd); 42 | 43 | fd = open("test1", O_CREAT); 44 | printf( "fcntl flags =0x%x\n", fcntl( fd, F_GETFL ) ); 45 | close(fd); 46 | 47 | fd = open("test", O_RDONLY); 48 | if (fd == -1) { 49 | printf("Starting on the wrong foot....\n"); 50 | exit(-1); 51 | } 52 | 53 | printf( "fcntl flags =0x%x\n", fcntl( fd, F_GETFL ) ); 54 | 55 | fp = fdopen(fd, "r"); 56 | if (fp == NULL) { 57 | printf("Nothing ever goes my way!\n"); 58 | close(fd); 59 | exit(-1); 60 | } else { 61 | printf("Soon, I will be able to take over the world!\n"); 62 | fgets(str, 200, fp); 63 | printf("%s\n", str); 64 | fclose(fp); 65 | } 66 | 67 | exit(0); 68 | } 69 | 70 | /* configuration information */ 71 | 72 | /* NOTICE: the clock driver is explicitly disabled */ 73 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 74 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 75 | 76 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 77 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 6 78 | 79 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 80 | #define CONFIGURE_MAXIMUM_TASKS 1 81 | 82 | #define CONFIGURE_INIT 83 | 84 | #include 85 | /* end of file */ 86 | -------------------------------------------------------------------------------- /file_io/fdopen/wscript: -------------------------------------------------------------------------------- 1 | import rtems_waf.rtems as rtems 2 | 3 | def build(bld): 4 | rtems.build(bld) 5 | 6 | bld(features = 'c cprogram', 7 | target = 'fdopen.exe', 8 | source = ['test.c']) 9 | 10 | if rtems.check_env(bld, 'RTEMS_TLD'): 11 | bld(features = 'c rtrace', 12 | target = 'fdopen.texe', 13 | source = ['test.c'], 14 | rtrace_cfg = '../../file_io/fdopen/fdopen.ini', 15 | rtrace_wrapper = 'fdopen_wrapper') 16 | -------------------------------------------------------------------------------- /file_io/filerdback/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | EXEC=test.exe 10 | PGM=${ARCH}/$(EXEC) 11 | 12 | # C source names 13 | CSRCS = test.c 14 | COBJS_ = $(CSRCS:.c=.o) 15 | COBJS = $(COBJS_:%=${ARCH}/%) 16 | 17 | # C++ source names 18 | CXXSRCS = 19 | CXXOBJS_ = $(CXXSRCS:.cc=.o) 20 | CXXOBJS = $(CXXOBJS_:%=${ARCH}/%) 21 | 22 | # AS source names 23 | ASSRCS = 24 | ASOBJS_ = $(ASSRCS:.s=.o) 25 | ASOBJS = $(ASOBJS_:%=${ARCH}/%) 26 | 27 | # Libraries 28 | LIBS = -lrtemsall -lc 29 | 30 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 31 | 32 | include $(RTEMS_CUSTOM) 33 | include $(PROJECT_ROOT)/make/leaf.cfg 34 | 35 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 36 | 37 | all: ${ARCH} $(PGM) 38 | 39 | $(PGM): $(OBJS) 40 | $(make-exe) 41 | 42 | -------------------------------------------------------------------------------- /file_io/filerdback/README: -------------------------------------------------------------------------------- 1 | # 2 | # README for simple example application 3 | # 4 | 5 | In this directory, you will find a simple RTEMS application and a Makefile. 6 | It can be built by setting the environment variable "RTEMS_MAKEFILE_PATH" 7 | and invoking make. 8 | 9 | Here are a couple of example ways to do this using the erc32 BSP: 10 | 11 | RTEMS_MAKEFILE_PATH=/home/joel/gnat-3.10p/sparc-rtems/rtems/erc32 gmake 12 | 13 | The resulting application end up in o-erc32/test.exe. 14 | 15 | An alterative way to do this is to set the environment variable separately: 16 | 17 | export RTEMS_MAKEFILE_PATH=/home/joel/gnat-3.10p/sparc-rtems/rtems/erc32 18 | gmake 19 | -------------------------------------------------------------------------------- /file_io/filerdback/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program to write and read a file back. 3 | */ 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | char *bufr = "Happy days are here again. Happy days are here again.1Happy " 16 | "days are here again.2Happy days are here again.3Happy days are here again." 17 | "4Happy days are here again.5Happy days are here again.6Happy days are here " 18 | "again.7Happy days are here again."; 19 | 20 | rtems_task Init( 21 | rtems_task_argument ignored 22 | ) 23 | { 24 | int fd; 25 | int i, n, total; 26 | char *bufr2; 27 | 28 | printf( "BUFSIZ = %d\n", BUFSIZ ); 29 | bufr2 = (char *)malloc(BUFSIZ); 30 | fd = creat("tester", S_IRWXU | S_IRWXG | S_IRWXO); 31 | for (i=0; i<10; i++) { 32 | n=write(fd, bufr, strlen(bufr)); 33 | printf("Wrote %d\n", n); 34 | } 35 | close(fd); 36 | 37 | total = 0; 38 | fd = open("tester", O_RDONLY); 39 | while ((n=read(fd,bufr2,60)) > 0) { 40 | bufr2[n-1] = '\0'; 41 | total += n; 42 | printf("Read=%d, total=%d : %s\n", n, total, bufr2); 43 | } 44 | free(bufr2); 45 | close(fd); 46 | exit(0); 47 | } 48 | 49 | /* configuration information */ 50 | 51 | /* NOTICE: the clock driver is explicitly disabled */ 52 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 53 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 54 | 55 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 56 | 57 | #define CONFIGURE_MAXIMUM_TASKS 1 58 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 59 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 4 60 | 61 | #define CONFIGURE_INIT 62 | 63 | #include 64 | 65 | /* end of file */ 66 | -------------------------------------------------------------------------------- /file_io/filerdback/wscript: -------------------------------------------------------------------------------- 1 | import rtems_waf.rtems as rtems 2 | 3 | def build(bld): 4 | rtems.build(bld) 5 | 6 | bld(features = 'c cprogram', 7 | target = 'test.exe', 8 | source = ['test.c']) 9 | -------------------------------------------------------------------------------- /file_io/repeated_opens/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | EXEC=test.exe 10 | PGM=${ARCH}/$(EXEC) 11 | 12 | # C source names 13 | CSRCS = test.c 14 | COBJS_ = $(CSRCS:.c=.o) 15 | COBJS = $(COBJS_:%=${ARCH}/%) 16 | 17 | # C++ source names 18 | CXXSRCS = 19 | CXXOBJS_ = $(CXXSRCS:.cc=.o) 20 | CXXOBJS = $(CXXOBJS_:%=${ARCH}/%) 21 | 22 | # AS source names 23 | ASSRCS = 24 | ASOBJS_ = $(ASSRCS:.s=.o) 25 | ASOBJS = $(ASOBJS_:%=${ARCH}/%) 26 | 27 | # Libraries 28 | LIBS = -lrtemsall -lc 29 | 30 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 31 | 32 | include $(RTEMS_CUSTOM) 33 | include $(PROJECT_ROOT)/make/leaf.cfg 34 | 35 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 36 | 37 | all: ${ARCH} $(PGM) 38 | 39 | $(PGM): $(OBJS) 40 | $(make-exe) 41 | 42 | -------------------------------------------------------------------------------- /file_io/repeated_opens/README: -------------------------------------------------------------------------------- 1 | # 2 | # README for simple example application 3 | # 4 | 5 | In this directory, you will find a simple RTEMS application and a Makefile. 6 | It can be built by setting the environment variable "RTEMS_MAKEFILE_PATH" 7 | and invoking make. 8 | 9 | Here are a couple of example ways to do this using the erc32 BSP: 10 | 11 | RTEMS_MAKEFILE_PATH=/home/joel/gnat-3.10p/sparc-rtems/rtems/erc32 gmake 12 | 13 | The resulting application end up in o-erc32/test.exe. 14 | 15 | An alterative way to do this is to set the environment variable separately: 16 | 17 | export RTEMS_MAKEFILE_PATH=/home/joel/gnat-3.10p/sparc-rtems/rtems/erc32 18 | gmake 19 | -------------------------------------------------------------------------------- /file_io/repeated_opens/test.c: -------------------------------------------------------------------------------- 1 | /* Open/close test */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | rtems_task Init(rtems_task_argument a) 16 | { 17 | int i; 18 | int fd; 19 | char msg[16]; 20 | int len; 21 | int l; 22 | 23 | printf("Open/close test (%d)\n",(int)a); 24 | 25 | strcpy(msg,"OK!\n"); 26 | len = strlen(msg); 27 | 28 | for(i = 0; i < 10000; i++){ 29 | fd = open("/tempfile",O_RDWR|O_CREAT, 0666); 30 | if(fd < 0){ 31 | printf("open failed on %dth try (%s).\n",i, strerror(errno)); 32 | continue; 33 | } 34 | l = write(fd,msg,len); 35 | if(l != len){ 36 | printf("write failed on %dth try. (%d)\n",i,l); 37 | break; 38 | } 39 | close(fd); 40 | if ( i && (i%100 == 0)) printf("pass %d\n", i); 41 | 42 | } 43 | printf("Done.\n"); 44 | exit(0); 45 | } 46 | 47 | /* NOTICE: the clock driver is explicitly disabled */ 48 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 49 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 50 | 51 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 52 | 53 | #define CONFIGURE_MAXIMUM_TASKS 1 54 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 4 55 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 56 | 57 | #define CONFIGURE_INIT 58 | #include 59 | 60 | -------------------------------------------------------------------------------- /file_io/repeated_opens/wscript: -------------------------------------------------------------------------------- 1 | import rtems_waf.rtems as rtems 2 | 3 | def build(bld): 4 | rtems.build(bld) 5 | 6 | bld(features = 'c cprogram', 7 | target = 'test.exe', 8 | source = ['test.c']) 9 | -------------------------------------------------------------------------------- /file_io/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('crc') 10 | bld.recurse('fdopen') 11 | bld.recurse('filerdback') 12 | bld.recurse('repeated_opens') 13 | -------------------------------------------------------------------------------- /filesystem/fat_ramdisk/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/fat_ramdisk.exe 6 | 7 | # C source names 8 | CSRCS = init.c FilesystemImage.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | CLEAN_ADDITIONS += stamp-fs-image 12 | CLEAN_ADDITIONS += FilesystemImage FilesystemImage.c FilesystemImage.h 13 | 14 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 15 | include $(RTEMS_CUSTOM) 16 | include $(PROJECT_ROOT)/make/leaf.cfg 17 | 18 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 19 | 20 | all: ${ARCH} $(OBJS) $(PGM) 21 | 22 | $(ARCH)/init.o: init.c stamp-fs-image 23 | 24 | $(ARCH)/FilesystemImage.o: stamp-fs-image FilesystemImage.c FilesystemImage.h 25 | 26 | FilesystemImage: $(ARCH) rootfs/shell-init 27 | cd rootfs ; \ 28 | tar cf ../FilesystemImage --exclude CVS --exclude .cvsignore . 29 | 30 | stamp-fs-image: $(ARCH) FilesystemImage 31 | $(PROJECT_ROOT)/bin/rtems-bin2c FilesystemImage FilesystemImage 32 | ls -l Filesystem* 33 | touch stamp-fs-image 34 | 35 | $(PGM): $(OBJS) 36 | $(make-exe) 37 | -------------------------------------------------------------------------------- /filesystem/fat_ramdisk/README: -------------------------------------------------------------------------------- 1 | This is a simple example which illustrates how to use the 2 | In-Memory File System (IMFS) in conjunction with "untar" to 3 | load the initial contents. 4 | 5 | Thanks to Gedare Bloom for the code this is based upon. 6 | -------------------------------------------------------------------------------- /filesystem/fat_ramdisk/fat_ramdisk.ini: -------------------------------------------------------------------------------- 1 | ; 2 | ; RTEMS Trace Linker Configuration: FAT File system 3 | ; 4 | [tracer] 5 | ; 6 | ; Name of the trace. 7 | ; 8 | name = FAT Filesystem RTEMS Tracer 9 | ; 10 | ; Options can be defined here or on the command line. 11 | ; 12 | ;options = verbose 13 | ; 14 | ; Functions to trace. 15 | ; 16 | traces = rtems-score-object-all 17 | traces = rtems-score-thread-all 18 | traces = rtems-score-threadq-all 19 | traces = rtems-score-heap-all 20 | ; 21 | ; Define the function sets. These are the function's that can be 22 | ; added to the trace lists. 23 | ; 24 | functions = rtems-score 25 | ; 26 | ; Include RTEMS Trace support. 27 | ; 28 | include = rtems.ini, rtld-base.ini 29 | -------------------------------------------------------------------------------- /filesystem/fat_ramdisk/rootfs/shell-init: -------------------------------------------------------------------------------- 1 | mkdos /dev/rda 2 | mkdir /rd 3 | mount -t dosfs /dev/rda /rd 4 | -------------------------------------------------------------------------------- /filesystem/fat_ramdisk/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for RTEMS fat_ramdisk 7 | 8 | import rtems_waf.rtems as rtems 9 | import rtems_waf.rootfs as rootfs 10 | 11 | version = "1.0.0" 12 | 13 | def build(bld): 14 | rtems.build(bld) 15 | 16 | arch_bsp = bld.get_env()['RTEMS_ARCH_BSP'] 17 | arch = bld.get_env()['RTEMS_ARCH'] 18 | bsp = bld.get_env()['RTEMS_BSP'] 19 | 20 | # 21 | # The include paths and defines. 22 | # 23 | bld.includes = ['.'] 24 | bld.defines = ['PACKAGE_VERSION="' + version + '"'] 25 | 26 | # 27 | # Package the root file system as a C file. 28 | # 29 | if rtems.check_env(bld, 'RTEMS_BIN2C', 'RTEMS_TLD'): 30 | rootfs.build_from_src_root(bld, 31 | name = 'fs-root', 32 | root = 'rootfs') 33 | 34 | bld.path.find_or_declare('fs-root-tar.h') 35 | 36 | bld(features = 'c cprogram', 37 | target = 'fat_ramdisk.exe', 38 | includes = bld.includes, 39 | defines = bld.defines, 40 | source = ['init.c', 'fs-root-tar.c']) 41 | 42 | bld(features = 'c rtrace', 43 | target = 'fat_ramdisk.texe', 44 | includes = bld.includes, 45 | defines = bld.defines, 46 | source = ['init.c', 'fs-root-tar.c'], 47 | rtrace_cfg = '../../filesystem/fat_ramdisk/fat_ramdisk.ini') 48 | -------------------------------------------------------------------------------- /gdb/README: -------------------------------------------------------------------------------- 1 | This directory contains a collection of programs designed 2 | to demonstrate how to use gdb in various ways. Most of them 3 | contain deliberate bugs. :) 4 | 5 | --joel 6 | -------------------------------------------------------------------------------- /gdb/overwrite/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/overwrite.exe 6 | 7 | # C source names 8 | CSRCS = overwrite.c rtems_init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /gdb/overwrite/README: -------------------------------------------------------------------------------- 1 | This program deliberately writes past the end of an array and 2 | corrupts another variable. This is done so the program can 3 | be used to demonstrate how the gdb "watch" command can be used 4 | to track down this type of programming error. 5 | -------------------------------------------------------------------------------- /gdb/overwrite/overwrite.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program to demonstrate memory overwrite. 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | typedef struct { 11 | uint32_t TooShortArray[8]; 12 | uint32_t RandomVariable; 13 | uint32_t CorruptedVariable; 14 | } Struct_t; 15 | 16 | Struct_t S; 17 | 18 | void writeEntry(int index, uint32_t value); 19 | 20 | int main( 21 | int argc, 22 | char **argv 23 | ) 24 | { 25 | puts( "\n\n*** MEMORY CORRUPTION EXAMPLE ***" ); 26 | 27 | /* initialize global variables */ 28 | memset( &S, 0, sizeof(S) ); 29 | S.RandomVariable = 0x1234; 30 | S.CorruptedVariable = 0x5678; 31 | 32 | printf( 33 | "&TooShortArray[0] = %p\n" 34 | "&TooShortArray[7] = %p\n" 35 | "&RandomVariable = %p\n" 36 | "&CorruptedVariable = %p\n", 37 | &S.TooShortArray[0], 38 | &S.TooShortArray[7], 39 | &S.RandomVariable, 40 | &S.CorruptedVariable 41 | ); 42 | /* write past end of array */ 43 | writeEntry( 8, 0xdeadf00d ); 44 | writeEntry( 9, 0x0badd00d ); 45 | 46 | printf( 47 | "RandomVariable = 0x%08x\n" 48 | "CorruptedVariable = 0x%08x\n", 49 | S.RandomVariable, 50 | S.CorruptedVariable 51 | ); 52 | puts( "*** END OF MEMORY CORRUPTION EXAMPLE ***" ); 53 | exit( 0 ); 54 | } 55 | 56 | void writeEntry(int index, uint32_t value) 57 | { 58 | S.TooShortArray[index] = value; 59 | } 60 | -------------------------------------------------------------------------------- /gdb/overwrite/rtems_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Wrapper for Overwrite main(). 3 | */ 4 | 5 | #include 6 | 7 | #include 8 | 9 | int main( int, char ** ); 10 | 11 | rtems_task Init( 12 | rtems_task_argument ignored 13 | ) 14 | { 15 | main( 0, NULL ); 16 | exit( 0 ); /* just in case */ 17 | } 18 | 19 | /* configuration information */ 20 | 21 | /* NOTICE: the clock driver is explicitly disabled */ 22 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 23 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 24 | 25 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 26 | #define CONFIGURE_MAXIMUM_TASKS 1 27 | 28 | #define CONFIGURE_INIT 29 | 30 | #include 31 | 32 | /* end of file */ 33 | -------------------------------------------------------------------------------- /gdb/overwrite/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'overwrite.exe', 14 | source = ['overwrite.c', 'rtems_init.c']) 15 | -------------------------------------------------------------------------------- /gdb/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('overwrite') 10 | -------------------------------------------------------------------------------- /hello/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS=hello_world_c 6 | 7 | # If the POSIX API isn't enabled, we can't build these 8 | ifeq ($(RTEMS_HAS_POSIX_API),yes) 9 | SUBDIRS += portable_hello posix_hello_world both_hello 10 | endif 11 | -------------------------------------------------------------------------------- /hello/both_hello/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/both_hello.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /hello/both_hello/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program -- simplified version of sample test hello. 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | rtems_task Init( 11 | rtems_task_argument ignored 12 | ) 13 | { 14 | printf( "Classic -- Hello World\n" ); 15 | rtems_task_delete( RTEMS_SELF ); 16 | } 17 | 18 | void *POSIX_Init( 19 | void *argument 20 | ) 21 | { 22 | printf( "POSIX -- Hello World\n" ); 23 | sleep( 1 ); 24 | exit( 0 ); 25 | } 26 | 27 | /* configuration information */ 28 | 29 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 30 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 31 | 32 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 33 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 34 | 35 | #define CONFIGURE_MAXIMUM_TASKS 1 36 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 37 | 38 | #define CONFIGURE_INIT 39 | #include 40 | /* end of file */ 41 | -------------------------------------------------------------------------------- /hello/both_hello/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # Copyright 2014 Chris Johns (chrisj@rtems.org) 3 | # 4 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 5 | # 6 | 7 | # Waf build script for an RTEMS Hello 8 | import rtems_waf.rtems as rtems 9 | 10 | def build(bld): 11 | rtems.build(bld) 12 | 13 | # if rtems.check_env(bld, 'RTEMS_TLD'): 14 | # bld(features = 'c rtrace', 15 | # target = 'both_hello.texe', 16 | # source = ['test.c'], 17 | # rtrace_cfg = '../../hello/both_hello/hello.ini', 18 | # rtrace_wrapper = 'hello-test') 19 | # bld(features = 'c rtrace', 20 | # target = 'hello-deep.texe', 21 | # source = ['test.c'], 22 | # rtrace_cfg = '../../hello/both_hello/hello-deep.ini', 23 | # rtrace_wrapper = 'hello-deep') 24 | 25 | bld(features = 'c cprogram', 26 | target = 'both_hello.exe', 27 | source = ['test.c']) 28 | -------------------------------------------------------------------------------- /hello/hello_world_c/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/hello.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /hello/hello_world_c/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Classic API Hello World 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | rtems_task Init( 10 | rtems_task_argument ignored 11 | ) 12 | { 13 | printf( "\n\n*** HELLO WORLD TEST ***\n" ); 14 | printf( "Hello World\n" ); 15 | printf( "*** END OF HELLO WORLD TEST ***\n" ); 16 | exit( 0 ); 17 | } 18 | 19 | /* configuration information */ 20 | 21 | #include 22 | 23 | /* NOTICE: the clock driver is explicitly disabled */ 24 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 25 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 26 | 27 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 28 | #define CONFIGURE_MAXIMUM_TASKS 1 29 | 30 | #define CONFIGURE_INIT 31 | #include 32 | /* end of file */ 33 | -------------------------------------------------------------------------------- /hello/hello_world_c/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'hello.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /hello/portable_hello/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/portable_hello.exe 6 | 7 | # C source names 8 | CSRCS = test.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /hello/portable_hello/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: BSD-2-Clause */ 2 | 3 | /* 4 | * This file contains the RTEMS Configuration for this example. 5 | * It provides a POSIX Initialization thread which performs initialization 6 | * of support capabilities (e.g. networking, mounting filesystems, etc.) 7 | * and then invokes main(). By following the pattern of having RTEMS 8 | * configuration and initialization contained in a separate file, the 9 | * application can be portable POSIX code with no RTEMS references. 10 | */ 11 | 12 | /* 13 | * Copyright 2024 Joel Sherrill (joel@rtems.org) 14 | * 15 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 16 | */ 17 | 18 | #include 19 | 20 | int main(int argc, char **argv); 21 | 22 | static char *argv_list[] = { 23 | "hello", 24 | "" 25 | }; 26 | 27 | static void *POSIX_Init(void *arg) 28 | { 29 | (void) arg; /* deliberately ignored */ 30 | 31 | int rc; 32 | 33 | /* 34 | * Initialize optional services 35 | */ 36 | 37 | /* 38 | * Could get arguments from command line or have a static set. 39 | */ 40 | rc = main(1, argv_list); 41 | 42 | exit(rc); 43 | 44 | return NULL; 45 | } 46 | 47 | 48 | /* configuration information */ 49 | 50 | #include 51 | 52 | /* NOTICE: the clock driver is explicitly disabled */ 53 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 54 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 55 | 56 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 57 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 58 | 59 | #define CONFIGURE_INIT 60 | #include 61 | /* end of file */ 62 | -------------------------------------------------------------------------------- /hello/portable_hello/test.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: BSD-2-Clause */ 2 | 3 | /* 4 | * Portable POSIX hello world example. 5 | * This provides an example of using POSIX source with RTEMS and not 6 | * introducing RTEMS dependencies. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | int main( 13 | int argc, 14 | char **argv 15 | ) 16 | { 17 | printf( "\n\n*** HELLO WORLD TEST ***\n" ); 18 | printf( "Hello World\n" ); 19 | printf( "*** END OF HELLO WORLD TEST ***\n" ); 20 | 21 | /* 22 | * Can return or call exit() directly. 23 | */ 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /hello/portable_hello/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'portable_hello.exe', 14 | source = ['test.c','rtems_config.c']) 15 | -------------------------------------------------------------------------------- /hello/posix_hello_world/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/posix_hello.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /hello/posix_hello_world/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program -- simplified version of sample test hello. 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | void *POSIX_Init( 9 | void *argument 10 | ) 11 | { 12 | printf( "\n\n*** HELLO WORLD TEST ***\n" ); 13 | printf( "Hello World\n" ); 14 | printf( "*** END OF HELLO WORLD TEST ***\n" ); 15 | exit( 0 ); 16 | } 17 | 18 | /* configuration information */ 19 | 20 | #include 21 | 22 | /* NOTICE: the clock driver is explicitly disabled */ 23 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 24 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 25 | 26 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 27 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 28 | 29 | #define CONFIGURE_INIT 30 | #include 31 | /* end of file */ 32 | -------------------------------------------------------------------------------- /hello/posix_hello_world/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'posix_hello.exe', 14 | source = ['test.c']) 15 | -------------------------------------------------------------------------------- /hello/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('hello_world_c') 10 | bld.recurse('posix_hello_world') 11 | bld.recurse('portable_hello') 12 | bld.recurse('both_hello') 13 | 14 | -------------------------------------------------------------------------------- /led/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS=delay event_server msg_server sem_server ratemon1 ratemon2 \ 6 | timeout_event timer timer_server 7 | 8 | # If the POSIX API isn't enabled, we can't build these 9 | ifeq ($(RTEMS_HAS_POSIX_API),yes) 10 | SUBDIRS += posix_cond_server posix_delay_sleep posix_delay_nanosleep \ 11 | posix_mutex_server ratemon_cond_server 12 | # This test requires POSIX and C++ 13 | ifneq ($(CXX_FOR_TARGET),) 14 | SUBDIRS += complex1 15 | endif 16 | endif 17 | -------------------------------------------------------------------------------- /led/README: -------------------------------------------------------------------------------- 1 | This is a set of example RTEMS programs. Most of these programs are 2 | demonstrations various ways to use inter-task communication to 3 | turn and LED on and off at a fixed rate. 4 | 5 | You must edit led.h so it knows how to turn an LED on and off on your 6 | target hardware. 7 | 8 | The example programs form a logical sequence in the following order: 9 | 10 | hello_world_c 11 | posix_hello_world 12 | ticker 13 | delay 14 | ratemon1 15 | ratemon2 16 | timeout_event 17 | event_server 18 | sem_server 19 | msg_server 20 | timer 21 | cpuuse 22 | posix_delay_nanosleep 23 | posix_delay_sleep 24 | posix_mutex_server 25 | 26 | -------------------------------------------------------------------------------- /led/complex1/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/complex1.exe 6 | 7 | # C source names 8 | CSRCS = periodic.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | # C++ source names 12 | CXXSRCS = main.cc menu.cc test.cc 13 | CXXOBJS_ = $(CXXSRCS:.cc=.o) 14 | CXXOBJS = $(CXXOBJS_:%=${ARCH}/%) 15 | 16 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 17 | LINK.c=$(CXX) 18 | include $(RTEMS_CUSTOM) 19 | include $(PROJECT_ROOT)/make/leaf.cfg 20 | 21 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 22 | 23 | all: ${ARCH} $(PGM) 24 | 25 | $(PGM): $(OBJS) 26 | $(make-cxx-exe) 27 | -------------------------------------------------------------------------------- /led/complex1/Makefile.linux: -------------------------------------------------------------------------------- 1 | CXXFLAGS=-Wall 2 | LDFLAGS=-lpthread 3 | 4 | PROGRAMS=example 5 | 6 | OBJECTS=main.o menu.o test.o 7 | 8 | all: $(PROGRAMS) 9 | 10 | main.o: main.cc 11 | menu.o: menu.cc 12 | test.o: test.cc 13 | 14 | example: $(OBJECTS) 15 | $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) 16 | 17 | clean: 18 | rm -f core* $(PROGRAMS) *.o 19 | 20 | install: 21 | -------------------------------------------------------------------------------- /led/complex1/main.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Starting point for this example. Can be compiled on RTEMS or Linux. 3 | */ 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | extern void doTest(void); 11 | 12 | #if defined(__rtems__) 13 | #include 14 | 15 | extern "C" { 16 | rtems_task Init( 17 | rtems_task_argument arg 18 | ); 19 | }; 20 | 21 | rtems_task Init( 22 | rtems_task_argument arg 23 | ) 24 | #else 25 | int main( 26 | int argc, 27 | char **argv 28 | ) 29 | #endif 30 | { 31 | #if !defined(BSP_SMALL_MEMORY) 32 | doTest(); 33 | #endif 34 | exit( 0 ); 35 | } 36 | 37 | #if defined(__rtems__) 38 | /* RTEMS configuration information */ 39 | 40 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 41 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 42 | #define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1) 43 | 44 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 45 | 46 | #if defined(BSP_SMALL_MEMORY) 47 | #define CONFIGURE_MAXIMUM_TASKS 1 48 | #else 49 | #define CONFIGURE_MAXIMUM_TASKS 102 50 | #define CONFIGURE_MAXIMUM_PERIODS 100 51 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 2 52 | #define CONFIGURE_EXTRA_TASK_STACKS (32 * 1024) 53 | 54 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM 55 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20 56 | 57 | #define CONFIGURE_STACK_CHECKER_ENABLED 58 | #endif 59 | 60 | #define CONFIGURE_INIT 61 | 62 | #include 63 | #endif 64 | 65 | /* end of file */ 66 | -------------------------------------------------------------------------------- /led/complex1/menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a general set of routines to provide a user interface 3 | * for testing. 4 | */ 5 | 6 | #ifndef __menu_h 7 | #define __menu_h 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | typedef void (*test_menu_routine_t)( void ); /* Test routine */ 15 | 16 | typedef struct { /* entry for a test */ 17 | const char *name; 18 | test_menu_routine_t routine; 19 | } Menu_entry; 20 | 21 | typedef struct { /* A menu */ 22 | const char *header; 23 | unsigned int number_of_entries; 24 | Menu_entry *entry; 25 | } Test_menu; 26 | 27 | /* 28 | * returns an int between min and max for value described by str. 29 | */ 30 | 31 | int Test_menu_Get_int_bounded( 32 | const char *str, 33 | int min, 34 | int max 35 | ); 36 | 37 | float Test_menu_Get_float_bounded( 38 | const char *str, 39 | float min, 40 | float max 41 | ); 42 | 43 | int Test_menu_Get_int( 44 | char *str 45 | ); 46 | 47 | /* 48 | * Returns a selection from the selection list. 49 | */ 50 | 51 | int Test_menu_Get_selection( 52 | const char *title, 53 | int select_count, 54 | char *selection[] 55 | ); 56 | 57 | /* 58 | * Returns a user entered string. This is a static local variable. 59 | */ 60 | 61 | char *Test_menu_Get_string( 62 | const char *str 63 | ); 64 | 65 | /* 66 | * Displays and processes the menu passed in. 67 | */ 68 | 69 | void Test_menu_run( 70 | Test_menu *menu 71 | ); 72 | 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /led/complex1/periodic.h: -------------------------------------------------------------------------------- 1 | #ifndef __PERIOD_THREADS_h 2 | #define __PERIOD_THREADS_h 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern unsigned int PeriodicThreads_Count; 9 | 10 | 11 | void PeriodicThreads_Start(void); 12 | 13 | void PeriodicThreads_Stop(void); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | /* end of include file */ 21 | -------------------------------------------------------------------------------- /led/complex1/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'cxx cxxprogram', 13 | target = 'complex1.exe', 14 | source = ['periodic.c', 'main.cc', 'menu.cc', 'test.cc']) 15 | -------------------------------------------------------------------------------- /led/delay/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/delay.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/delay/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2009. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #include "../led.h" 14 | 15 | rtems_task Init( 16 | rtems_task_argument argument 17 | ) 18 | { 19 | rtems_interval one_second; 20 | 21 | puts( "\n\n*** LED BLINKER -- task wake after ***" ); 22 | 23 | one_second = 1 * rtems_clock_get_ticks_per_second(); 24 | 25 | LED_INIT(); 26 | 27 | while (1) { 28 | 29 | (void) rtems_task_wake_after( one_second ); 30 | LED_OFF(); 31 | (void) rtems_task_wake_after( one_second ); 32 | LED_ON(); 33 | 34 | } 35 | 36 | (void) rtems_task_delete( RTEMS_SELF ); 37 | } 38 | 39 | /**************** START OF CONFIGURATION INFORMATION ****************/ 40 | 41 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 42 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 43 | 44 | #define CONFIGURE_MAXIMUM_TASKS 1 45 | 46 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 47 | 48 | #define CONFIGURE_INIT 49 | #include 50 | 51 | /**************** END OF CONFIGURATION INFORMATION ****************/ 52 | -------------------------------------------------------------------------------- /led/delay/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'delay.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/event_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/event_server.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/event_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'event_server.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/msg_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/msg_server.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/msg_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'msg_server.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/posix_cond_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/posix_condvar.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/posix_cond_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'posix_condvar.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/posix_delay_nanosleep/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/posix_delay_nanosleep.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/posix_delay_nanosleep/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program -- simplified version of sample test hello. 3 | */ 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "../led.h" 12 | 13 | void *POSIX_Init( 14 | void *argument 15 | ) 16 | { 17 | struct timespec delay; 18 | 19 | puts( "\n\n*** LED BLINKER -- nanosleep ***" ); 20 | 21 | LED_INIT(); 22 | 23 | delay.tv_sec = 1; 24 | delay.tv_nsec = 0; 25 | while (1) { 26 | 27 | (void) nanosleep( &delay, NULL ); 28 | LED_OFF(); 29 | (void) nanosleep( &delay, NULL ); 30 | LED_ON(); 31 | 32 | } 33 | exit( 0 ); 34 | } 35 | 36 | /* configuration information */ 37 | 38 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 44 | 45 | #define CONFIGURE_INIT 46 | 47 | #include 48 | 49 | /* end of file */ 50 | -------------------------------------------------------------------------------- /led/posix_delay_nanosleep/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'posix_delay_nanosleep.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/posix_delay_sleep/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/posix_delay_nanosleep.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/posix_delay_sleep/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program -- simplified version of sample test hello. 3 | */ 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "../led.h" 13 | 14 | void *POSIX_Init( 15 | void *argument 16 | ) 17 | { 18 | puts( "\n\n*** LED BLINKER -- sleep ***" ); 19 | 20 | LED_INIT(); 21 | 22 | while (1) { 23 | 24 | (void) sleep( 1 ); 25 | LED_OFF(); 26 | (void) sleep( 1 ); 27 | LED_ON(); 28 | 29 | } 30 | exit( 0 ); 31 | } 32 | 33 | /* configuration information */ 34 | 35 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 36 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 37 | 38 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 39 | 40 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 41 | 42 | #define CONFIGURE_INIT 43 | 44 | #include 45 | 46 | /* end of file */ 47 | -------------------------------------------------------------------------------- /led/posix_delay_sleep/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'posix_delay_nanosleep.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/posix_mutex_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/posix_mutex_server.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/posix_mutex_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'posix_mutex_server.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/ratemon1/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/ratemon1.exe 6 | 7 | # C source names 8 | CSRCS = init.c #task.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/ratemon1/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2009. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #include "../led.h" 14 | 15 | rtems_task Init( 16 | rtems_task_argument argument 17 | ) 18 | { 19 | rtems_id period_id; 20 | rtems_interval ticks; 21 | uint32_t count; 22 | 23 | puts( "\n\n*** LED BLINKER -- single period ***" ); 24 | 25 | LED_INIT(); 26 | 27 | (void) rtems_rate_monotonic_create( 28 | rtems_build_name( 'P', 'E', 'R', '1' ), 29 | &period_id 30 | ); 31 | 32 | ticks = rtems_clock_get_ticks_per_second(); 33 | 34 | for (count=0; ; count++) { 35 | (void) rtems_rate_monotonic_period( period_id, ticks ); 36 | if ( (count % 2) == 0 ) 37 | LED_OFF(); 38 | else 39 | LED_ON(); 40 | } 41 | 42 | (void) rtems_task_delete( RTEMS_SELF ); 43 | } 44 | 45 | /**************** START OF CONFIGURATION INFORMATION ****************/ 46 | 47 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 48 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 49 | 50 | #define CONFIGURE_MAXIMUM_TASKS 1 51 | #define CONFIGURE_MAXIMUM_PERIODS 1 52 | 53 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 54 | 55 | #define CONFIGURE_INIT 56 | #include 57 | 58 | /**************** END OF CONFIGURATION INFORMATION ****************/ 59 | -------------------------------------------------------------------------------- /led/ratemon1/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'ratemon1.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/ratemon2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/ratemon2.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/ratemon2/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2009. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #include "../led.h" 14 | 15 | rtems_task Init( 16 | rtems_task_argument argument 17 | ) 18 | { 19 | rtems_id period_id1; 20 | rtems_id period_id2; 21 | rtems_interval ticks; 22 | 23 | puts( "\n\n*** LED BLINKER -- two periods ***" ); 24 | 25 | LED_INIT(); 26 | 27 | (void) rtems_rate_monotonic_create( 28 | rtems_build_name( 'P', 'E', 'R', '1' ), 29 | &period_id1 30 | ); 31 | 32 | (void) rtems_rate_monotonic_create( 33 | rtems_build_name( 'P', 'E', 'R', '2' ), 34 | &period_id2 35 | ); 36 | 37 | ticks = rtems_clock_get_ticks_per_second(); 38 | 39 | (void) rtems_rate_monotonic_period( period_id1, 2 * ticks ); 40 | LED_OFF(); 41 | 42 | (void) rtems_task_wake_after( ticks ); 43 | (void) rtems_rate_monotonic_period( period_id2, 2 * ticks ); 44 | LED_ON(); 45 | 46 | while (1) { 47 | (void) rtems_rate_monotonic_period( period_id1, 2 * ticks ); 48 | LED_OFF(); 49 | 50 | (void) rtems_rate_monotonic_period( period_id2, 2 * ticks ); 51 | LED_ON(); 52 | } 53 | 54 | (void) rtems_task_delete( RTEMS_SELF ); 55 | } 56 | 57 | /**************** START OF CONFIGURATION INFORMATION ****************/ 58 | 59 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 60 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 61 | 62 | #define CONFIGURE_MAXIMUM_TASKS 1 63 | #define CONFIGURE_MAXIMUM_PERIODS 2 64 | 65 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 66 | 67 | #define CONFIGURE_INIT 68 | #include 69 | 70 | /**************** END OF CONFIGURATION INFORMATION ****************/ 71 | -------------------------------------------------------------------------------- /led/ratemon2/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'ratemon2.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/ratemon_cond_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/ratemon_cond_server.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/ratemon_cond_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'ratemon_cond_server.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/sem_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/sem_server.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/sem_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'sem_server.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/timeout_event/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/timeout_event.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/timeout_event/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2009. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "../led.h" 15 | 16 | rtems_task Init( 17 | rtems_task_argument argument 18 | ) 19 | { 20 | rtems_status_code status; 21 | rtems_event_set events; 22 | uint32_t count = 0; 23 | 24 | puts( "\n\n*** LED BLINKER -- event receive timeout ***" ); 25 | 26 | LED_INIT(); 27 | 28 | for (count=0; ; count++) { 29 | 30 | status = rtems_event_receive( 31 | RTEMS_EVENT_1, 32 | RTEMS_DEFAULT_OPTIONS, 33 | rtems_clock_get_ticks_per_second(), 34 | &events 35 | ); 36 | if ( status != RTEMS_TIMEOUT ) 37 | fputs( "receive did not timeout\n", stderr ); 38 | 39 | if ( (count % 2) == 0 ) 40 | LED_OFF(); 41 | else 42 | LED_ON(); 43 | 44 | } 45 | 46 | (void) rtems_task_delete( RTEMS_SELF ); 47 | } 48 | 49 | /**************** START OF CONFIGURATION INFORMATION ****************/ 50 | 51 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 52 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 53 | 54 | #define CONFIGURE_MAXIMUM_TASKS 1 55 | 56 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 57 | 58 | #define CONFIGURE_INIT 59 | #include 60 | 61 | /**************** END OF CONFIGURATION INFORMATION ****************/ 62 | -------------------------------------------------------------------------------- /led/timeout_event/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'timeout_event.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/timer/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/timer.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/timer/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'timer.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/timer_server/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/timer_server.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /led/timer_server/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2009. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #include "../led.h" 14 | 15 | rtems_id Timer1; 16 | rtems_id Timer2; 17 | 18 | rtems_timer_service_routine Timer_Routine( rtems_id id, void *ignored ) 19 | { 20 | if ( id == Timer1 ) 21 | LED_OFF(); 22 | else 23 | LED_ON(); 24 | 25 | (void) rtems_timer_server_fire_after( 26 | id, 27 | 2 * rtems_clock_get_ticks_per_second(), 28 | Timer_Routine, 29 | NULL 30 | ); 31 | } 32 | 33 | rtems_task Init( 34 | rtems_task_argument argument 35 | ) 36 | { 37 | puts( "\n\n*** LED BLINKER -- timer_server ***" ); 38 | 39 | LED_INIT(); 40 | 41 | (void) rtems_timer_initiate_server( 42 | 1, 43 | RTEMS_MINIMUM_STACK_SIZE * 2, 44 | RTEMS_DEFAULT_ATTRIBUTES 45 | ); 46 | 47 | (void) rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &Timer1); 48 | 49 | (void) rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '2' ), &Timer2); 50 | 51 | Timer_Routine(Timer1, NULL); 52 | 53 | (void) rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); 54 | 55 | Timer_Routine(Timer2, NULL); 56 | 57 | (void) rtems_task_delete( RTEMS_SELF ); 58 | } 59 | 60 | 61 | /**************** START OF CONFIGURATION INFORMATION ****************/ 62 | 63 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 64 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 65 | 66 | #define CONFIGURE_MAXIMUM_TASKS 2 67 | #define CONFIGURE_MAXIMUM_TIMERS 2 68 | 69 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 70 | 71 | #define CONFIGURE_EXTRA_TASK_STACKS (RTEMS_MINIMUM_STACK_SIZE) 72 | 73 | #define CONFIGURE_INIT 74 | #include 75 | /**************** END OF CONFIGURATION INFORMATION ****************/ 76 | -------------------------------------------------------------------------------- /led/timer_server/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'timer_server.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /led/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('timer') 10 | bld.recurse('sem_server') 11 | bld.recurse('msg_server') 12 | bld.recurse('delay') 13 | bld.recurse('timer_server') 14 | bld.recurse('event_server') 15 | bld.recurse('timeout_event') 16 | bld.recurse('ratemon1') 17 | bld.recurse('ratemon2') 18 | bld.recurse('ratemon_cond_server') 19 | bld.recurse('posix_cond_server') 20 | bld.recurse('posix_delay_nanosleep') 21 | bld.recurse('posix_delay_sleep') 22 | bld.recurse('posix_mutex_server') 23 | # This test requires POSIX and C++ 24 | if bld.env['CXX'] is not None: 25 | bld.recurse('complex1') 26 | -------------------------------------------------------------------------------- /lvgl/README: -------------------------------------------------------------------------------- 1 | This folder contains a sample graphics app using littleVGL library and libbsd 2 | The generated exe file can be directly run using a JTAG debugger on a target 3 | with the right device tree or this can be converted into an image. 4 | 5 | For instructions on how to build the image or how to run the exe, please refer 6 | to the BSP documentation in https://docs.rtems.org 7 | -------------------------------------------------------------------------------- /lvgl/gui/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Vijay Kumar Banerjee (vijay@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | import rtems_waf.rtems_bsd as rtems_bsd 8 | import os 9 | 10 | def build(bld): 11 | rtems.build(bld) 12 | if rtems.check_lib(bld, ['bsd', 'lvgl']): 13 | arch_inc_path = rtems.arch_bsp_include_path(str(bld.env.RTEMS_VERSION), 14 | str(bld.env.RTEMS_ARCH_BSP)) 15 | include_paths = ['', 16 | 'lvgl', 17 | 'lvgl/src', 18 | 'lv_drivers/display', 19 | 'lv_drivers/indev',] 20 | 21 | for i in range(0,len(include_paths)): 22 | include_paths[i] = os.path.join(bld.env.PREFIX, arch_inc_path, include_paths[i]) 23 | 24 | bld(features = 'c cprogram', 25 | target = 'lvgl_gui.exe', 26 | source = ['test.c'], 27 | includes = include_paths, 28 | lib = ['m', 'lvgl', 'bsd']) 29 | -------------------------------------------------------------------------------- /lvgl/hello/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Vijay Kumar Banerjee (vijaykumar9597@gmail.com) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | import rtems_waf.rtems_bsd as rtems_bsd 8 | import os 9 | 10 | def build(bld): 11 | rtems.build(bld) 12 | if rtems.check_lib(bld, ['bsd', 'lvgl']): 13 | arch_inc_path = rtems.arch_bsp_include_path(str(bld.env.RTEMS_VERSION), 14 | str(bld.env.RTEMS_ARCH_BSP)) 15 | include_paths = ['', 16 | 'lvgl', 17 | 'lvgl/src', 18 | 'lv_drivers/display',] 19 | 20 | for i in range(0,len(include_paths)): 21 | include_paths[i] = os.path.join(bld.env.PREFIX, arch_inc_path, include_paths[i]) 22 | 23 | bld(features = 'c cprogram', 24 | target = 'lvgl_hello.exe', 25 | source = ['test.c'], 26 | includes = include_paths, 27 | lib = ['m', 'lvgl', 'bsd']) 28 | -------------------------------------------------------------------------------- /lvgl/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Vijay Kumar Banerjee (vijaykumar9597@gmail.com) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | import rtems_waf.rtems_bsd as rtems_bsd 8 | import os 9 | 10 | def configure(conf): 11 | arch_lib_path = rtems.arch_bsp_lib_path(conf.env.RTEMS_VERSION, 12 | conf.env.RTEMS_ARCH_BSP) 13 | arch_lib_path = os.path.join(conf.env.PREFIX, arch_lib_path) 14 | rtems.check_lib_path(conf, lib = 'm') 15 | rtems.check_lib_path(conf, lib = 'lvgl', 16 | libpath = [arch_lib_path], 17 | mandatory = False) 18 | rtems.check_lib_path(conf, lib = 'bsd', 19 | libpath = [arch_lib_path], 20 | mandatory = False) 21 | 22 | def build(bld): 23 | bld.recurse('hello') 24 | bld.recurse('gui') 25 | -------------------------------------------------------------------------------- /micromonitor/README: -------------------------------------------------------------------------------- 1 | This directory contains examples related to MicroMonitor. 2 | -------------------------------------------------------------------------------- /micromonitor/diagnostics/README: -------------------------------------------------------------------------------- 1 | This is an example of a non-RTEMS diagnostics program built using 2 | MicroMonitor and the RTEMS tools. It isn't setup to auto-adapt 3 | to a new BSP. You will have to edit the makefile. 4 | 5 | This program reads a key from the user to indicate what the results 6 | of the "diagnostics" should (e.g. PASS, FAIL, or UNKNOWN). The 7 | MicroMonitor environment variable DIAGNOSTICS_RESULT is set to 8 | that value. This environment variable may be queried by MicroMonitor 9 | scripts and the RTEMS application. 10 | 11 | The file appboot in this directory is the MicroMonitor script that does this. 12 | -------------------------------------------------------------------------------- /micromonitor/diagnostics/appboot: -------------------------------------------------------------------------------- 1 | # TOP: 2 | set DIAGNOSTICS_RESULT # clear this variable 3 | diagnostics 4 | if $DIAGNOSTICS_RESULT sne PASS goto FIX_ME_NOW 5 | echo "Diagnostics passed, running RTEMS Application 6 | ether off 7 | rtemsapp # RTEMS app does not exit 8 | goto TOP 9 | 10 | # FIX_ME_NOW: 11 | echo "Diagnostics failed, please call FIX-A-BOARD" 12 | goto TOP # repeat 13 | -------------------------------------------------------------------------------- /micromonitor/diagnostics/cfg.h: -------------------------------------------------------------------------------- 1 | #define APPSTACKSIZE 0x2000 2 | -------------------------------------------------------------------------------- /micromonitor/diagnostics/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a simple example of a "diagnostic" program that 3 | * could be run before a real application. 4 | * 5 | * main(): 6 | * The main() function demonstrates a simple way to communicate the diagnostics 7 | * result back to the MicroMonitor script. 8 | */ 9 | 10 | #include "monlib.h" 11 | 12 | int getakey(void) 13 | { 14 | while(!mon_gotachar()); 15 | return mon_getchar(); 16 | } 17 | 18 | int 19 | main(int argc,char *argv[]) 20 | { 21 | char *result = (char *)0; 22 | 23 | mon_printf( 24 | "\n\nDiagnotics Program\n" 25 | "Should the diagnostics return p (pass), u (unknown), f (fail)? >" 26 | ); 27 | 28 | /* 29 | * Run the diagnostics. OK in this case, we are just asking the 30 | * user to decide if they passed or failed. 31 | */ 32 | while (1) { 33 | int c = getakey(); 34 | mon_printf( "%c\n", c); 35 | if ( c == 'p' ) { 36 | result = "PASS"; 37 | break; 38 | } 39 | if ( c == 'f' ) { 40 | result = "FAIL"; 41 | break; 42 | } 43 | if ( c == 'u' ) { 44 | result = "UNKNOWN"; 45 | break; 46 | } 47 | mon_printf( "Unknown response %c -- try again\n", c ); 48 | } 49 | 50 | /* 51 | * We broke out of the loop so must have a result. 52 | */ 53 | mon_setenv( "DIAGNOSTICS_RESULT", result ); 54 | 55 | mon_printf( 56 | "Set DIAGNOSTICS_RESULT to %s\n" 57 | "At the MicroMonitor prompt: echo $DIAGNOSTICS_RESULT\n", 58 | mon_getenv("DIAGNOSTICS_RESULT") 59 | ); 60 | 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /micromonitor/umon/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | VPATH=. 6 | PGM=${ARCH}/umon.exe 7 | 8 | # C source names 9 | CSRCS = test.c ## monlib.c tfsDriver.c 10 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 11 | 12 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 13 | include $(RTEMS_CUSTOM) 14 | include $(PROJECT_ROOT)/make/leaf.cfg 15 | 16 | ## DEFINES += -I. 17 | 18 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 19 | 20 | all: ${ARCH} $(PGM) 21 | 22 | $(PGM): $(OBJS) 23 | $(make-exe) 24 | -------------------------------------------------------------------------------- /micromonitor/umon/README: -------------------------------------------------------------------------------- 1 | This is a demonstration of using Micromonitor capabilities from an 2 | RTEMS application. 3 | 4 | The following files are from umon-1.17: 5 | 6 | monlib.c 7 | monlib.h 8 | tfs.h 9 | cli.h 10 | 11 | After printing the arguments, it will attempt to cat the contents 12 | of mon_getenv("TFSFS_FILENAME") followed by "csbboot" and "boot" 13 | from the TFS filesystem. 14 | -------------------------------------------------------------------------------- /micromonitor/umon/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'umon.exe', 14 | source = ['test.c']) 15 | -------------------------------------------------------------------------------- /micromonitor/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bsp = bld.get_env()['RTEMS_BSP'] 10 | if (bsp == 'csb337'): 11 | bld.recurse('umon') 12 | -------------------------------------------------------------------------------- /misc/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS=minimum bspcmdline extract_example nanosecond_tick_wrap userdrv 6 | 7 | # If the POSIX API isn't enabled, we can't build these 8 | ifeq ($(RTEMS_HAS_POSIX_API),yes) 9 | # SUBDIRS += adamain 10 | endif 11 | 12 | # If regulator.h is not present, do not build that example 13 | ifneq (,$(RTEMS_MAKEFILE_PATH).lib/include/rtems/regulator.h) 14 | SUBDIRS += regulator 15 | endif 16 | 17 | -------------------------------------------------------------------------------- /misc/adamain/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/adamain.exe 6 | 7 | # C source names 8 | CSRCS = adacode.c rtems_init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /misc/adamain/README: -------------------------------------------------------------------------------- 1 | This directory contains a copy of the standard rtems_init.c which is 2 | used to start Ada applications compiled with GNAT/RTEMS. This test 3 | exists solely to have a way to test this code without having to 4 | have Ada code. That introduces another variable. 5 | 6 | -------------------------------------------------------------------------------- /misc/adamain/adacode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2009. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be found in 6 | * the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | #include 11 | 12 | int gnat_main( 13 | int argc, 14 | char **argv 15 | ) 16 | { 17 | int i; 18 | printf( "gnat_main: argc=%d\n", argc ); 19 | for (i=0 ; i 6 | #include "userLib.h" 7 | 8 | void example_library_function( 9 | int x 10 | ) 11 | { 12 | printf( "example_library_function(%d)\n", x ); 13 | } 14 | -------------------------------------------------------------------------------- /misc/applib/private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Example Private .h file from user library 3 | */ 4 | 5 | #ifndef __Private_h 6 | #define __Private_h 7 | 8 | /* nothing to declare, just an example */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /misc/applib/userLib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Example Public .h file from user library 3 | */ 4 | 5 | #ifndef __User_Library_h 6 | #define __User_Library_h 7 | 8 | void example_library_function( 9 | int x 10 | ); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /misc/applib/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cstlib', 13 | target = 'UserLib.exe', 14 | source = ['file_1.c']) 15 | -------------------------------------------------------------------------------- /misc/bspcmdline/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/bspcmdline.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /misc/bspcmdline/README: -------------------------------------------------------------------------------- 1 | Some BSPs are invoked from environments which can provide boot 2 | arguments. This program accesses the boot string provided 3 | by the BSP. 4 | -------------------------------------------------------------------------------- /misc/bspcmdline/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Demonstrate accessing Boot Command Line provided by BSP 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | void print_arg( 12 | const char *param 13 | ) 14 | { 15 | const char *p; 16 | char value[80]; 17 | size_t length; 18 | 19 | printf( "\nLooking for param=(%s)\n", param ); 20 | 21 | length = sizeof(value); 22 | p = rtems_bsp_cmdline_get_param( param, value, length ); 23 | if ( !p ) { 24 | printf( "Did not locate param=(%s)\n", param ); 25 | return; 26 | } 27 | 28 | p = rtems_bsp_cmdline_get_param_rhs( param, value, length ); 29 | if ( !p ) { 30 | printf( "param=(%s) has no right hand side\n", param ); 31 | } else { 32 | printf( "param=(%s) has right hand side of %s\n", param, p ); 33 | } 34 | 35 | } 36 | 37 | rtems_task Init( 38 | rtems_task_argument ignored 39 | ) 40 | { 41 | const char *bspcmdline; 42 | 43 | printf( "\n\n*** BSP Command Demonstration ***\n" ); 44 | 45 | /* 46 | * Let's see if this BSP provided one at all 47 | */ 48 | bspcmdline = rtems_bsp_cmdline_get(); 49 | if ( !bspcmdline ) { 50 | puts( "BSP does not have a boot command line" ); 51 | goto demo_over; 52 | } 53 | 54 | printf( "BSP has a boot command line:\n" "%s\n", bspcmdline ); 55 | 56 | /* 57 | * The PC386 has some defined arguments. Did we see any of those? 58 | */ 59 | print_arg( "--console" ); 60 | print_arg( "--ide" ); 61 | print_arg( "--ide-show" ); 62 | 63 | 64 | demo_over: 65 | printf( "*** END OF BSP Command Line Demonstration ***\n" ); 66 | exit( 0 ); 67 | } 68 | 69 | /* configuration information */ 70 | 71 | /* NOTICE: the clock driver is explicitly disabled */ 72 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 73 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 74 | 75 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 76 | #define CONFIGURE_MAXIMUM_TASKS 1 77 | 78 | #define CONFIGURE_INIT 79 | 80 | #include 81 | 82 | /* end of file */ 83 | -------------------------------------------------------------------------------- /misc/bspcmdline/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'bspcmdline.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /misc/extract_example/.gitignore: -------------------------------------------------------------------------------- 1 | RTEMS_SETTINGS 2 | -------------------------------------------------------------------------------- /misc/extract_example/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile to pull BSP specific information into a form the script can use 3 | # 4 | 5 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 6 | 7 | include $(RTEMS_CUSTOM) 8 | include $(PROJECT_ROOT)/make/leaf.cfg 9 | 10 | # Tool helpers 11 | rtemsdir=${RTEMS_MAKEFILE_PATH} 12 | CARGS += $(CPU_CFLAGS) $(LDFLAGS) $(AM_LDFLAGS) 13 | 14 | all: RTEMS_SETTINGS 15 | 16 | RTEMS_SETTINGS: 17 | (echo "CC=$(CC)"; \ 18 | echo "AS=$(AS)"; \ 19 | echo "CPU_CFLAGS=$(CPU_CFLAGS)"; \ 20 | echo "CFLAGS=$(CFLAGS)" ; \ 21 | echo "LDFLAGS=$(LDFLAGS)" ; \ 22 | ) >$@ 23 | @cat RTEMS_SETTINGS 24 | 25 | clean: 26 | rm -f RTEMS_SETTINGS 27 | -------------------------------------------------------------------------------- /misc/extract_example/README: -------------------------------------------------------------------------------- 1 | This directory contains a Makefile demonstrating how to extract information 2 | from an installed RTEMS. 3 | -------------------------------------------------------------------------------- /misc/minimum/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/minimum.exe 6 | 7 | # C source names 8 | CSRCS = test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /misc/minimum/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'minimum.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /misc/nanosecond_tick_wrap/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/nanoseconds_tick_wrap.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /misc/nanosecond_tick_wrap/README: -------------------------------------------------------------------------------- 1 | PR 1748 [1] points out a general problem that many BSPs could have in their 2 | nanoseconds since last tick handler. This problem occurs when: 3 | 4 | + We are in the middle of getting TOD or Update AND 5 | + Clock tick counter goes to 0 6 | 7 | Then the nanoseconds since last tick handler needs to account for either 8 | a clock interrupt pending (if the counter resets) or the counter wrapping 9 | below 0. The following illustrates the interrupt pending method: 10 | 11 | iuint32_t bsp_clock_nanoseconds_since_last_tick(void) 12 | { 13 | uint32_t clicks; 14 | uint32_t usecs; 15 | 16 | clicks = HARDWARE_COUNTER; 17 | 18 | usecs = TO_USECS(clicks); 19 | if ( Is_interrupt_pending( CLOCK_VECTOR ) ) 20 | usecs += rtems_configuration_get_microseconds_per_tick(); 21 | return usecs * 1000; 22 | } 23 | 24 | 25 | References 26 | ========== 27 | 28 | [1] https://www.rtems.org/bugzilla/show_bug.cgi?id=1748 29 | -------------------------------------------------------------------------------- /misc/nanosecond_tick_wrap/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * COPYRIGHT (c) 1989-2011. 3 | * On-Line Applications Research Corporation (OAR). 4 | * 5 | * The license and distribution terms for this file may be 6 | * found in the file LICENSE in this distribution or at 7 | * http://www.rtems.com/license/LICENSE. 8 | */ 9 | 10 | /* Based upon code in PR1748 */ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #define LOOPS 1000 18 | uint32_t uptime_usec[LOOPS]; 19 | struct timespec uptime[LOOPS]; 20 | 21 | rtems_task Init( 22 | rtems_task_argument argument 23 | ) 24 | { 25 | int i; 26 | uint32_t t0=0; 27 | 28 | puts( "\n\n*** Nanosecond Clock Tick Wrap Test ***" ); 29 | for ( i=0; i 69 | 70 | /**************** END OF CONFIGURATION INFORMATION ****************/ 71 | 72 | -------------------------------------------------------------------------------- /misc/nanosecond_tick_wrap/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'nanoseconds_tick_wrap.exe', 14 | source = ['init.c']) 15 | -------------------------------------------------------------------------------- /misc/qemu_vfat/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/qemu_vfat.exe 6 | 7 | # C source names 8 | CSRCS = init.c start_test.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | # Define this if you want to run the shell after mounting 16 | # DEFINES += -DUSE_SHELL 17 | # Defint this if you want to call start_test() instead 18 | DEFINES += -DUSE_START_TEST 19 | 20 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 21 | 22 | all: ${ARCH} $(PGM) 23 | 24 | $(PGM): $(OBJS) 25 | $(make-exe) 26 | -------------------------------------------------------------------------------- /misc/qemu_vfat/README: -------------------------------------------------------------------------------- 1 | This directory contains an example program which should be of use 2 | in some situations. It is designed to be used with Qemu's 3 | virtual FAT file system support. Qemu can make a directory on 4 | the host computer appear as a FAT file system to the simulated 5 | system. This capability appears to have limits on the number 6 | and size of files as well as some limitations about writes 7 | from the simulated system appearing in the native file system. 8 | But this should be useful for testing interpreters like Parrot, 9 | Mono, or the RTEMS Shell. 10 | 11 | When testing an interpreter, you often want to have the same 12 | executable exercised with different arguments or input files. 13 | With this setup, you can copy those test support files into 14 | the host directory and the RTEMS "main" will use those in 15 | support of the testing. 16 | 17 | -------------------------------------------------------------------------------- /misc/qemu_vfat/start_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Start Test Example 3 | */ 4 | 5 | #if defined(USE_START_TEST) 6 | 7 | #define __need_getopt_newlib 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define COMMAND_LINE_ARGUMENTS_FILE "arguments" 15 | 16 | #define ARGV_LENGTH 80 17 | #define ARGV_LIMIT 32 18 | 19 | int Argc; 20 | char *Argv[ARGV_LIMIT]; 21 | char Argv_String[ ARGV_LENGTH ]; 22 | 23 | void parse_arguments(void) 24 | { 25 | FILE *in; 26 | char *cStatus; 27 | size_t length; 28 | int sc; 29 | 30 | in = fopen( COMMAND_LINE_ARGUMENTS_FILE, "r" ); 31 | if ( !in ) { 32 | fprintf( stderr, "Unable to open %s\n", COMMAND_LINE_ARGUMENTS_FILE ); 33 | exit(1); 34 | } 35 | 36 | cStatus = fgets( Argv_String, sizeof(Argv_String), in ); 37 | if ( cStatus == NULL ) { 38 | fprintf( stderr, "Unable to read %s\n", COMMAND_LINE_ARGUMENTS_FILE ); 39 | exit(1); 40 | } 41 | 42 | // If the last line does not have a CR, then we don't want to 43 | // arbitrarily clobber an = instead of a \n. 44 | length = strlen(Argv_String); 45 | if ( Argv_String[ length - 1] != '\n' ) { 46 | fprintf( 47 | stderr, 48 | "Line appears to be too long in %s\n", 49 | COMMAND_LINE_ARGUMENTS_FILE 50 | ); 51 | exit(1); 52 | } 53 | 54 | Argv_String[ length - 1] = '\0'; 55 | 56 | sc = rtems_shell_make_args( 57 | &Argv_String[0], 58 | &Argc, 59 | &Argv[1], 60 | ARGV_LIMIT - 1 61 | ); 62 | if ( sc ) { 63 | fprintf( stderr, "Error parsing arguments\n" ); 64 | exit(1); 65 | } 66 | 67 | /* Since we added the program name ourselves and started at 0 */ 68 | Argc++; 69 | fclose(in); 70 | } 71 | 72 | void print_arguments(void) 73 | { 74 | int i; 75 | 76 | for ( i=0 ; i 6 | #include 7 | #include 8 | 9 | rtems_task Init( 10 | rtems_task_argument ignored 11 | ) 12 | { 13 | printk( "\n\n*** x86 DISPLAY CPU CAPABILITIES TEST ***\n" ); 14 | printCpuInfo(); 15 | printk( "\n\n*** END OF x86 DISPLAY CPU CAPABILITIES TEST ***\n" ); 16 | 17 | exit( 0 ); 18 | } 19 | 20 | /* configuration information */ 21 | 22 | /* NOTICE: the clock driver is explicitly disabled */ 23 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 24 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 25 | 26 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 27 | #define CONFIGURE_MAXIMUM_TASKS 1 28 | 29 | #define CONFIGURE_INIT 30 | 31 | #include 32 | 33 | /* end of file */ 34 | -------------------------------------------------------------------------------- /misc/x86_display_cpu/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'display_cpu.exe', 14 | source = ['test.c'],) 15 | -------------------------------------------------------------------------------- /posix_api/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | # If the POSIX API isn't enabled, we can't build these 6 | ifeq ($(RTEMS_HAS_POSIX_API),yes) 7 | SUBDIRS = psx_example_1 8 | SUBDIRS += psx_example_2 9 | SUBDIRS += psx_example_3 10 | SUBDIRS += psx_barrier_report 11 | SUBDIRS += psx_condvar_report 12 | SUBDIRS += psx_mqueue_report 13 | SUBDIRS += psx_mutex_report 14 | SUBDIRS += psx_pthread_report 15 | SUBDIRS += psx_rwlock_report 16 | SUBDIRS += psx_sched_report 17 | SUBDIRS += psx_sigint 18 | SUBDIRS += psx_task_restart 19 | SUBDIRS += psx_thread_restart 20 | SUBDIRS += livermore 21 | endif 22 | -------------------------------------------------------------------------------- /posix_api/livermore/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | # If the POSIX API isn't enabled, we can't build these 6 | ifeq ($(RTEMS_HAS_POSIX_API),yes) 7 | SUBDIRS = pthread 8 | endif 9 | -------------------------------------------------------------------------------- /posix_api/livermore/pthread/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/pthread.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/livermore/pthread/README: -------------------------------------------------------------------------------- 1 | This is a simple example which illustrates how to use the 2 | pthreads adapted from the Lawrence Livermore POSIX Pthreads 3 | tutorial: ​https://computing.llnl.gov/tutorials/pthreads/. 4 | 5 | Thanks to Christopher Kerl for providing the code. 6 | -------------------------------------------------------------------------------- /posix_api/livermore/pthread/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Marçal Comajoan Cara 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'pthread.exe', 13 | source = ['init.c']) 14 | -------------------------------------------------------------------------------- /posix_api/livermore/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Marçal Comajoan Cara 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('pthread') 10 | -------------------------------------------------------------------------------- /posix_api/psx_barrier_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_barrier_report.exe 6 | 7 | # C source names 8 | CSRCS = barrier_attr_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_barrier_report/barrier_attr_report.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Program to print default POSIX barrier attributes 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #ifndef OS_DOES_NOT_SUPPORT_BARRIERS 18 | 19 | static void print_shared(pthread_barrierattr_t *attr) 20 | { 21 | int rc; 22 | int shared; 23 | char *s; 24 | 25 | rc = pthread_barrierattr_getpshared( attr, &shared ); 26 | assert( rc == 0 ); 27 | 28 | switch ( shared ) { 29 | case PTHREAD_PROCESS_PRIVATE: s = "PTHREAD_PROCESS_PRIVATE"; break; 30 | case PTHREAD_PROCESS_SHARED: s = "PTHREAD_PROCESS_SHARED"; break; 31 | default: s = "UNKNOWN"; break; 32 | } 33 | 34 | printf( "Process shared: %s\n", s ); 35 | } 36 | #endif 37 | 38 | int main() 39 | { 40 | #ifndef OS_DOES_NOT_SUPPORT_BARRIERS 41 | pthread_barrierattr_t attr; 42 | #endif 43 | int rc; 44 | 45 | puts( "*** POSIX Barrier Default Attributes Report ***" ); 46 | 47 | #ifndef OS_DOES_NOT_SUPPORT_BARRIERS 48 | rc = pthread_barrierattr_init( &attr ); 49 | assert( rc == 0 ); 50 | 51 | print_shared( &attr ); 52 | #else 53 | printf( "Barriers are not supported\n" ); 54 | #endif 55 | 56 | puts( "*** END OF POSIX Barrier Default Attributes Report ***" ); 57 | exit( 0 ); 58 | } 59 | -------------------------------------------------------------------------------- /posix_api/psx_barrier_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_barrier_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Joel Sherrill (joel@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_barrier_report.exe', 13 | source = ['barrier_attr_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_condvar_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_condvar_report.exe 6 | 7 | # C source names 8 | CSRCS = condvar_attr_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_condvar_report/condvar_attr_report.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Program to print default POSIX condition variable attributes 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | static void print_shared(pthread_condattr_t *attr) 18 | { 19 | int rc; 20 | int shared; 21 | char *s; 22 | 23 | rc = pthread_condattr_getpshared( attr, &shared ); 24 | assert( rc == 0 ); 25 | 26 | switch ( shared ) { 27 | case PTHREAD_PROCESS_PRIVATE: s = "PTHREAD_PROCESS_PRIVATE"; break; 28 | case PTHREAD_PROCESS_SHARED: s = "PTHREAD_PROCESS_SHARED"; break; 29 | default: s = "UNKNOWN"; break; 30 | } 31 | 32 | printf( "Process shared: %s\n", s ); 33 | } 34 | 35 | static void print_clock(pthread_condattr_t *attr) 36 | { 37 | int rc; 38 | clockid_t clock; 39 | char *s; 40 | 41 | rc = pthread_condattr_getclock( attr, &clock ); 42 | assert( rc == 0 ); 43 | switch ( clock ) { 44 | case CLOCK_MONOTONIC: s = "CLOCK_MONOTONIC"; break; 45 | case CLOCK_PROCESS_CPUTIME_ID: s = "CLOCK_PROCESS_CPUTIME_ID"; break; 46 | case CLOCK_REALTIME: s = "CLOCK_REALTIME"; break; 47 | case CLOCK_THREAD_CPUTIME_ID: s = "CLOCK_THREAD_CPUTIME_ID"; break; 48 | default: s = "UNKNOWN"; break; 49 | } 50 | 51 | printf( "Clock: %s\n", s ); 52 | } 53 | 54 | int main() 55 | { 56 | pthread_condattr_t attr; 57 | int rc; 58 | 59 | puts( "*** POSIX Condition Variable Default Attributes Report ***" ); 60 | 61 | rc = pthread_condattr_init( &attr ); 62 | assert( rc == 0 ); 63 | 64 | print_shared( &attr ); 65 | print_clock( &attr ); 66 | 67 | puts( "*** END OF POSIX Condition Variable Default Attributes Report ***" ); 68 | exit( 0 ); 69 | } 70 | -------------------------------------------------------------------------------- /posix_api/psx_condvar_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_condvar_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_condvar_report.exe', 13 | source = ['condvar_attr_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_example_1/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | PGM=${ARCH}/psx_example_1.exe 10 | 11 | # C source names 12 | CSRCS = test1.c 13 | COBJS_ = $(CSRCS:.c=.o) 14 | COBJS = $(COBJS_:%=${ARCH}/%) 15 | 16 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 17 | include $(RTEMS_CUSTOM) 18 | include $(PROJECT_ROOT)/make/leaf.cfg 19 | 20 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 21 | 22 | all: ${ARCH} $(PGM) 23 | 24 | $(PGM): $(OBJS) 25 | $(make-exe) 26 | 27 | -------------------------------------------------------------------------------- /posix_api/psx_example_1/test1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void * print_hello(void * arg) 8 | { 9 | sleep(1); 10 | printf(": Hello World!\n"); 11 | return NULL; 12 | } 13 | 14 | void *POSIX_Init() 15 | { 16 | pthread_t child1; 17 | pthread_t child2; 18 | int status; 19 | 20 | status = pthread_create( &child1, NULL, print_hello, NULL ); 21 | if ( status ) perror("Error on create child 1"); 22 | 23 | status = pthread_create( &child2, NULL, print_hello, NULL ); 24 | if ( status ) perror("Error on create child 1"); 25 | 26 | printf("
: Wait for child2 thread...\n"); 27 | 28 | status = pthread_join( child1, NULL ); 29 | if ( status ) perror ("Error on join"); 30 | printf("
: Successfully joined with child1\n" ); 31 | exit(0); 32 | } 33 | 34 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 35 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 36 | 37 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 10 38 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 39 | #define CONFIGURE_INIT 40 | #include 41 | -------------------------------------------------------------------------------- /posix_api/psx_example_1/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'psx_example_1.exe', 14 | source = ['test1.c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_example_2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | PGM=${ARCH}/psx_example_2.exe 10 | 11 | # C source names 12 | CSRCS = test2.c 13 | COBJS_ = $(CSRCS:.c=.o) 14 | COBJS = $(COBJS_:%=${ARCH}/%) 15 | 16 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 17 | include $(RTEMS_CUSTOM) 18 | include $(PROJECT_ROOT)/make/leaf.cfg 19 | 20 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 21 | 22 | all: ${ARCH} $(PGM) 23 | 24 | $(PGM): $(OBJS) 25 | $(make-exe) 26 | 27 | -------------------------------------------------------------------------------- /posix_api/psx_example_2/test2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | pthread_mutex_t mutex; 8 | pthread_cond_t cond; 9 | 10 | void * print_hello(void * arg) 11 | { 12 | struct timeval time; 13 | struct timespec timeout; 14 | 15 | gettimeofday(&time, NULL); 16 | timeout.tv_sec = time.tv_sec + 2; 17 | timeout.tv_nsec = time.tv_usec * 1000; 18 | printf(": Hello World coming to wait!\n"); 19 | 20 | if (pthread_cond_timedwait(&cond, &mutex, &timeout)) 21 | perror ("Error on pthread_cond_timedwait"); 22 | 23 | printf(": Hello World exit to wait!\n"); 24 | return NULL; 25 | } 26 | 27 | void *POSIX_Init(void *arg) 28 | { 29 | pthread_t child; 30 | if ( pthread_create( &child, NULL, print_hello, NULL )) 31 | perror("Error on pthread_create"); 32 | printf("
: Wait for child thread...\n"); 33 | if ( pthread_join( child, NULL )) 34 | perror("Error on pthread_join"); 35 | return 0; 36 | } 37 | 38 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 40 | 41 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 10 42 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 43 | 44 | #define CONFIGURE_INIT 45 | #include 46 | -------------------------------------------------------------------------------- /posix_api/psx_example_2/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'psx_example_2.exe', 14 | source = ['test2.c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_example_3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | # 6 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 7 | # 8 | 9 | PGM=${ARCH}/psx_example_3.exe 10 | 11 | # C source names 12 | CSRCS = test3.c 13 | COBJS_ = $(CSRCS:.c=.o) 14 | COBJS = $(COBJS_:%=${ARCH}/%) 15 | 16 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 17 | include $(RTEMS_CUSTOM) 18 | include $(PROJECT_ROOT)/make/leaf.cfg 19 | 20 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 21 | 22 | all: ${ARCH} $(PGM) 23 | 24 | $(PGM): $(OBJS) 25 | $(make-exe) 26 | 27 | -------------------------------------------------------------------------------- /posix_api/psx_example_3/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'psx_example_3.exe', 14 | source = ['test3.c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_initial_sigmask/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_initial_sigmask.exe 6 | 7 | # C source names 8 | CSRCS = main.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_initial_sigmask/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_initial_sigmask/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_initial_sigmask.exe', 13 | source = ['main.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_mqueue_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_mqueue_report.exe 6 | 7 | # C source names 8 | CSRCS = mqueue_attr_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_mqueue_report/mqueue_attr_report.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Program to print default POSIX message queue attributes 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include /* For O_* constants */ 17 | #include 18 | #include 19 | 20 | static void print_attr(mqd_t mqd) 21 | { 22 | int rc; 23 | struct mq_attr attr; 24 | 25 | rc = mq_getattr( mqd, &attr ); 26 | assert( rc == 0 ); 27 | 28 | printf( "mq_maxmsg: %ld\n", attr.mq_maxmsg ); 29 | printf( "mq_msgsize: %ld\n", attr.mq_msgsize ); 30 | } 31 | 32 | int main() 33 | { 34 | mqd_t mqd; 35 | 36 | puts( "*** POSIX Message Queue Default Attributes Report ***" ); 37 | 38 | mqd = mq_open( "/testq", O_CREAT|O_RDWR, 0777, NULL ); 39 | if ( mqd == (mqd_t) -1 ) { 40 | perror("mq_open" ); 41 | } 42 | assert( mqd != (mqd_t) -1 ); 43 | 44 | print_attr( mqd ); 45 | 46 | puts( "*** END OF POSIX Message Queue Default Attributes Report ***" ); 47 | exit( 0 ); 48 | } 49 | -------------------------------------------------------------------------------- /posix_api/psx_mqueue_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_mqueue_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_mqueue_report.exe', 13 | source = ['mqueue_attr_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_mutex_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_mutex_report.exe 6 | 7 | # C source names 8 | CSRCS = mutex_attr_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_mutex_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | 12 | #include 13 | 14 | int main(int argc, char **argv); 15 | 16 | static char *argv_list[] = { 17 | "report", 18 | "" 19 | }; 20 | static void *POSIX_Init(void *arg) 21 | { 22 | (void) arg; /* deliberately ignored */ 23 | 24 | /* 25 | * Initialize optional services 26 | */ 27 | 28 | /* 29 | * Could get arguments from command line or have a static set. 30 | */ 31 | (void) main(1, argv_list); 32 | 33 | return NULL; 34 | } 35 | 36 | #include /* for device driver prototypes */ 37 | 38 | /* NOTICE: the clock driver is explicitly disabled */ 39 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 40 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 41 | 42 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 43 | 44 | #define CONFIGURE_UNLIMITED_OBJECTS 45 | #define CONFIGURE_UNIFIED_WORK_AREAS 46 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 47 | 48 | #define CONFIGURE_INIT 49 | #include 50 | -------------------------------------------------------------------------------- /posix_api/psx_mutex_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_mutex_report.exe', 13 | source = ['mutex_attr_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_pthread_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_pthread_report.exe 6 | 7 | # C source names 8 | CSRCS = pthread_attr_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_pthread_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_pthread_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_pthread_report.exe', 13 | source = ['pthread_attr_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_rwlock_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_rwlock_report.exe 6 | 7 | # C source names 8 | CSRCS = rwlock_attr_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_rwlock_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_rwlock_report/rwlock_attr_report.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Program to print default POSIX rwlock attributes 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | static void print_shared(pthread_rwlockattr_t *attr) 18 | { 19 | int rc; 20 | int shared; 21 | char *s; 22 | 23 | rc = pthread_rwlockattr_getpshared( attr, &shared ); 24 | assert( rc == 0 ); 25 | 26 | switch ( shared ) { 27 | case PTHREAD_PROCESS_PRIVATE: s = "PTHREAD_PROCESS_PRIVATE"; break; 28 | case PTHREAD_PROCESS_SHARED: s = "PTHREAD_PROCESS_SHARED"; break; 29 | default: s = "UNKNOWN"; break; 30 | } 31 | 32 | printf( "Process shared: %s\n", s ); 33 | } 34 | 35 | int main() 36 | { 37 | pthread_rwlockattr_t attr; 38 | int rc; 39 | 40 | puts( "*** POSIX RWLock Default Attributes Report ***" ); 41 | 42 | rc = pthread_rwlockattr_init( &attr ); 43 | assert( rc == 0 ); 44 | 45 | print_shared( &attr ); 46 | 47 | puts( "*** END OF POSIX RWLock Default Attributes Report ***" ); 48 | exit( 0 ); 49 | } 50 | -------------------------------------------------------------------------------- /posix_api/psx_rwlock_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_rwlock_report.exe', 13 | source = ['rwlock_attr_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_sched_report/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_sched_report.exe 6 | 7 | # C source names 8 | CSRCS = psx_sched_report.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_sched_report/README: -------------------------------------------------------------------------------- 1 | # 2 | # README for POSIX Scheduling information test 3 | # 4 | 5 | Prints some POSIX scheduling information and reports compliancy on 6 | some issues. 7 | -------------------------------------------------------------------------------- /posix_api/psx_sched_report/psx_sched_report.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Program to print POSIX Scheduler Characteristics 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | /* FreeBSD 10 needs this for struct timespec which seems wrong */ 15 | #include 16 | #include 17 | 18 | void print_sched_info( 19 | char *s, 20 | int policy 21 | ) 22 | { 23 | int min, max, levels; 24 | struct timespec t; 25 | 26 | printf( "Information on %s\n", s ); 27 | min = sched_get_priority_min( policy ); 28 | max = sched_get_priority_max( policy ); 29 | (void) sched_rr_get_interval( getpid(), &t ); 30 | levels = abs(max - min + 1); 31 | printf( "\tSupports %d priority levels (%d - %d)\n", levels, min, max ); 32 | if ( levels >= 32 ) 33 | printf( "\tImplementation is compliant on priority levels\n"); 34 | else 35 | printf( "\tImplementation is NOT compliant on priority levels\n" ); 36 | 37 | printf( "\tScheduling quantum is %ld seconds and %ld nanoseconds\n", 38 | (long)t.tv_sec, (long)t.tv_nsec ); 39 | puts( "" ); 40 | } 41 | 42 | int main() 43 | { 44 | puts( "*** POSIX Scheduler Characteristics Report ***" ); 45 | print_sched_info( "SCHED_OTHER", SCHED_OTHER ); 46 | print_sched_info( "SCHED_FIFO", SCHED_FIFO ); 47 | print_sched_info( "SCHED_RR", SCHED_RR ); 48 | #if defined(SCHED_SPORADIC) 49 | print_sched_info( "SCHED_SPORADIC", SCHED_SPORADIC ); 50 | #else 51 | printf( "SCHED_SPORADIC is not supported\n" ); 52 | #endif 53 | puts( "*** END OF POSIX Scheduler Characteristics Report ***" ); 54 | 55 | exit( 0 ); 56 | } 57 | -------------------------------------------------------------------------------- /posix_api/psx_sched_report/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | 20 | static void *POSIX_Init(void *arg) 21 | { 22 | (void) arg; /* deliberately ignored */ 23 | 24 | /* 25 | * Initialize optional services 26 | */ 27 | 28 | /* 29 | * Could get arguments from command line or have a static set. 30 | */ 31 | (void) main(1, argv_list); 32 | 33 | return NULL; 34 | } 35 | 36 | #include /* for device driver prototypes */ 37 | 38 | /* NOTICE: the clock driver is explicitly disabled */ 39 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 40 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 41 | 42 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 43 | 44 | #define CONFIGURE_UNLIMITED_OBJECTS 45 | #define CONFIGURE_UNIFIED_WORK_AREAS 46 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 47 | 48 | #define CONFIGURE_INIT 49 | #include 50 | -------------------------------------------------------------------------------- /posix_api/psx_sched_report/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_sched_report.exe', 13 | source = ['psx_sched_report.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_sigint/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_sigint.exe 6 | 7 | # C source names 8 | CSRCS = main.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_sigint/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "report", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_sigint/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_sigint.exe', 13 | source = ['main.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_task_restart/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_task_restart.exe 6 | 7 | # C source names 8 | CSRCS = psx_task_restart.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) $(PT_PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_task_restart/rtems_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains the RTEMS Configuration for this example. 3 | */ 4 | 5 | /* 6 | * Copyright 2018 Joel Sherrill (joel@rtems.org) 7 | * 8 | * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 9 | */ 10 | 11 | #include 12 | 13 | int main(int argc, char **argv); 14 | 15 | static char *argv_list[] = { 16 | "restart", 17 | "" 18 | }; 19 | static void *POSIX_Init(void *arg) 20 | { 21 | (void) arg; /* deliberately ignored */ 22 | 23 | /* 24 | * Initialize optional services 25 | */ 26 | 27 | /* 28 | * Could get arguments from command line or have a static set. 29 | */ 30 | (void) main(1, argv_list); 31 | 32 | return NULL; 33 | } 34 | 35 | #include /* for device driver prototypes */ 36 | 37 | /* NOTICE: the clock driver is explicitly disabled */ 38 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 39 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 40 | 41 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE 42 | 43 | #define CONFIGURE_UNLIMITED_OBJECTS 44 | #define CONFIGURE_UNIFIED_WORK_AREAS 45 | #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (64 * 1024) 46 | 47 | #define CONFIGURE_INIT 48 | #include 49 | -------------------------------------------------------------------------------- /posix_api/psx_task_restart/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_task_restart.exe', 13 | source = ['psx_task_restart.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/psx_thread_restart/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/psx_thread_restart.exe 6 | 7 | # C source names 8 | CSRCS = psx_thread_restart.c rtems_config.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) $(PT_PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /posix_api/psx_thread_restart/psx_thread_restart.c: -------------------------------------------------------------------------------- 1 | #define USE_PTHREADS 1 2 | 3 | #include "../psx_task_restart/psx_task_restart.c" 4 | -------------------------------------------------------------------------------- /posix_api/psx_thread_restart/rtems_config.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../psx_task_restart/rtems_config.c" 3 | -------------------------------------------------------------------------------- /posix_api/psx_thread_restart/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | rtems.build(bld) 10 | 11 | bld(features = 'c cprogram', 12 | target = 'psx_task_restart.exe', 13 | source = ['psx_thread_restart.c','rtems_config.c'], 14 | lib = ['c']) 15 | 16 | -------------------------------------------------------------------------------- /posix_api/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | if rtems.check_posix(bld): 10 | bld.recurse('psx_example_1') 11 | bld.recurse('psx_example_2') 12 | bld.recurse('psx_example_3') 13 | bld.recurse('psx_barrier_report') 14 | bld.recurse('psx_condvar_report') 15 | bld.recurse('psx_mqueue_report') 16 | bld.recurse('psx_mutex_report') 17 | bld.recurse('psx_pthread_report') 18 | bld.recurse('psx_rwlock_report') 19 | bld.recurse('psx_sched_report') 20 | bld.recurse('psx_sigint') 21 | bld.recurse('psx_task_restart') 22 | bld.recurse('psx_thread_restart') 23 | bld.recurse('livermore') 24 | -------------------------------------------------------------------------------- /schedsim/schedsim_priority/Makefile: -------------------------------------------------------------------------------- 1 | # Change this path to match your installation 2 | PREFIX=/tmp/schedsim 3 | OBJS = config.o printheir_executing.o schedsim.o wrap_thread_dispatch.o 4 | CPPFLAGS = -I${PREFIX}/include/schedsim 5 | LDFLAGS = -L${PREFIX}/lib 6 | LDFLAGS += -Wl,--wrap=_Thread_Dispatch 7 | SCHEDSIM=schedsim_priority 8 | 9 | all: stamp-test_prefix $(SCHEDSIM) 10 | 11 | stamp-test_prefix: 12 | test -d ${PREFIX} 13 | test -f ${PREFIX}/include/schedsim/rtems_sched.h 14 | touch stamp-test_prefix 15 | 16 | $(SCHEDSIM): $(OBJS) 17 | g++ -o $(SCHEDSIM) $(OBJS) $(LDFLAGS) -lschedsim -lrtems 18 | 19 | clean: 20 | rm -f *.o $(SCHEDSIM) stamp-test_prefix 21 | -------------------------------------------------------------------------------- /schedsim/schedsim_priority/README: -------------------------------------------------------------------------------- 1 | This is an example of how to build a custom RTEMS Scheduler Simulator 2 | instance for evaluation of new scheduling algorithms. 3 | -------------------------------------------------------------------------------- /schedsim/schedsim_priority/config.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define CONFIGURE_INIT 4 | #define CONFIGURE_MAXIMUM_TASKS 1000 5 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1000 6 | #include 7 | 8 | -------------------------------------------------------------------------------- /schedsim/schedsim_priority/example_script: -------------------------------------------------------------------------------- 1 | rtems_init 2 | task_create joel 1 3 | task_priority joel 0 4 | task_priority joel 5 5 | -------------------------------------------------------------------------------- /schedsim/schedsim_priority/printheir_executing.c: -------------------------------------------------------------------------------- 1 | /* 2 | * printheir_executing 3 | * 4 | * COPYRIGHT (c) 1989-2010. 5 | * On-Line Applications Research Corporation (OAR). 6 | * 7 | * The license and distribution terms for this file may be 8 | * found in the file LICENSE in this distribution or at 9 | * http://www.rtems.com/license/LICENSE. 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | void PRINT_EXECUTING() { 16 | printf( 17 | " Thread Executing: 0x%08x priority=%ld\n", 18 | _Thread_Executing->Object.id, 19 | (long) _Thread_Executing->current_priority 20 | ); 21 | } 22 | 23 | void PRINT_HEIR() { 24 | printf( 25 | " Thread Heir: 0x%08x priority=%ld\n", 26 | _Thread_Heir->Object.id, 27 | (long) _Thread_Heir->current_priority 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /schedsim/schedsim_priority/wrap_thread_dispatch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Thread Dispatch Wrapper Implmentation 3 | * 4 | * COPYRIGHT (c) 1989-2010. 5 | * On-Line Applications Research Corporation (OAR). 6 | * 7 | * The license and distribution terms for this file may be 8 | * found in the file LICENSE in this distribution or at 9 | * http://www.rtems.com/license/LICENSE. 10 | */ 11 | 12 | #include "shell.h" 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | Thread_Control *last_heir = NULL; 19 | Thread_Control *last_executing = NULL; 20 | 21 | extern void __real__Thread_Dispatch(void); 22 | 23 | void check_heir_and_executing(void) 24 | { 25 | if ( last_heir != _Thread_Heir ) 26 | PRINT_HEIR(); 27 | 28 | if ( last_executing != _Thread_Executing ) 29 | PRINT_EXECUTING(); 30 | 31 | last_heir = _Thread_Heir; 32 | last_executing = _Thread_Executing; 33 | } 34 | 35 | void __wrap__Thread_Dispatch(void) 36 | { 37 | check_heir_and_executing(); 38 | __real__Thread_Dispatch(); 39 | check_heir_and_executing(); 40 | } 41 | -------------------------------------------------------------------------------- /testmacros.h: -------------------------------------------------------------------------------- 1 | /* testmacros.h 2 | * 3 | * This include file contains some commonly used test macros. 4 | * 5 | * COPYRIGHT (c) 1989-2007. 6 | * On-Line Applications Research Corporation (OAR). 7 | * 8 | * The license and distribution terms for this file may be 9 | * found in the file LICENSE in this distribution or at 10 | * http://www.rtems.com/license/LICENSE. 11 | */ 12 | 13 | #ifndef __TEST_MACROS_h 14 | #define __TEST_MACROS_h 15 | 16 | /* 17 | * Handy macros and static inline functions 18 | */ 19 | 20 | /* 21 | * Macro to hide the ugliness of printing the time. 22 | */ 23 | 24 | #define print_time(_s1, _tb, _s2) \ 25 | do { \ 26 | printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ 27 | _s1, (int) (_tb)->hour, (int) (_tb)->minute, (int) (_tb)->second, \ 28 | (int) (_tb)->month, (int) (_tb)->day, (int) (_tb)->year, _s2 ); \ 29 | fflush(stdout); \ 30 | } while ( 0 ) 31 | 32 | /* 33 | * Macro to print an task name that is composed of ASCII characters. 34 | * 35 | */ 36 | 37 | #define put_name( _name, _crlf ) \ 38 | do { \ 39 | uint32_t c0, c1, c2, c3; \ 40 | \ 41 | c0 = ((_name) >> 24) & 0xff; \ 42 | c1 = ((_name) >> 16) & 0xff; \ 43 | c2 = ((_name) >> 8) & 0xff; \ 44 | c3 = (_name) & 0xff; \ 45 | putchar( (char)c0 ); \ 46 | if ( c1 ) putchar( (char)c1 ); \ 47 | if ( c2 ) putchar( (char)c2 ); \ 48 | if ( c3 ) putchar( (char)c3 ); \ 49 | if ( (_crlf) ) \ 50 | putchar( '\n' ); \ 51 | } while (0) 52 | 53 | /* 54 | * This allows us to view the "Test_task" instantiations as a set 55 | * of numbered tasks by eliminating the number of application 56 | * tasks created. 57 | * 58 | * In reality, this is too complex for the purposes of this 59 | * example. It would have been easier to pass a task argument. :) 60 | * But it shows how rtems_id's can sometimes be used. 61 | */ 62 | 63 | #define task_number( tid ) \ 64 | ( rtems_object_id_get_index( tid ) - \ 65 | rtems_configuration_get_rtems_api_configuration()->number_of_initialization_tasks ) 66 | 67 | #endif 68 | /* end of include file */ 69 | -------------------------------------------------------------------------------- /ticker/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | # Ticker Variations 6 | SUBDIRS = ticker 7 | SUBDIRS += ticker_stackchk 8 | SUBDIRS += ticker_trace 9 | SUBDIRS += low_ticker 10 | SUBDIRS += low_ticker1 11 | SUBDIRS += low_ticker2 12 | -------------------------------------------------------------------------------- /ticker/low_ticker/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/low_ticker.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /ticker/low_ticker/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'low_ticker.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /ticker/low_ticker1/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/low_ticker1.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /ticker/low_ticker1/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'low_ticker1.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /ticker/low_ticker2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/low_ticker2.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /ticker/low_ticker2/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'low_ticker2.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /ticker/ticker/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/ticker.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /ticker/ticker/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'ticker.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /ticker/ticker_stackchk/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/ticker.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /ticker/ticker_stackchk/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'ticker_stackchk.exe', 14 | source = ['init.c']) 15 | 16 | -------------------------------------------------------------------------------- /ticker/ticker_trace/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | PGM=${ARCH}/ticker.exe 6 | 7 | # C source names 8 | CSRCS = init.c 9 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 10 | 11 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 12 | include $(RTEMS_CUSTOM) 13 | include $(PROJECT_ROOT)/make/leaf.cfg 14 | 15 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 16 | 17 | all: ${ARCH} $(PGM) 18 | 19 | $(PGM): $(OBJS) 20 | $(make-exe) 21 | -------------------------------------------------------------------------------- /ticker/ticker_trace/ticker-deep.ini: -------------------------------------------------------------------------------- 1 | ; 2 | ; RTEMS Trace Linker Configuration: hello deep 3 | ; 4 | ; This script configure the both hello example to perform deep 5 | ; tracing of RTEMS via the printf trace generator. 6 | ; 7 | [tracer] 8 | ; 9 | ; Name of the trace. 10 | ; 11 | name = Hello Deep RTEMS Tracer 12 | ; 13 | ; Options can be defined here or on the command line. 14 | ; 15 | ;options = verbose 16 | ; 17 | ; Functions to trace. 18 | ; 19 | traces = hello-deep-trace 20 | traces = rtems-score-object-all 21 | traces = rtems-score-thread-all 22 | traces = rtems-score-threadq-all 23 | traces = rtems-score-heap-all 24 | ; 25 | ; Define the function sets. These are the function's that can be 26 | ; added to the trace lists. 27 | ; 28 | functions = hello-deep-trace 29 | functions = rtems-score 30 | ; 31 | ; Include RTEMS Trace support. 32 | ; 33 | include = rtems.ini, rtld-base.ini 34 | 35 | ; 36 | ; User application trace example. 37 | ; 38 | [hello-deep-trace] 39 | generator = printk-generator 40 | signatures = hello-signatures 41 | trace = exit, Init 42 | header = "#include " 43 | 44 | [hello-signatures] 45 | exit=void, int 46 | Init = void, rtems_task_argument 47 | -------------------------------------------------------------------------------- /ticker/ticker_trace/ticker.ini: -------------------------------------------------------------------------------- 1 | ; 2 | ; RTEMS Trace Linker Configuration: hello 3 | ; 4 | ; This script configure the both hello example to perform some 5 | ; tracing via the printf trace generator. 6 | ; 7 | [tracer] 8 | ; 9 | ; Name of the trace. 10 | ; 11 | name = Hello RTEMS Tracer 12 | ; 13 | ; Options can be defined here or on the command line. 14 | ; 15 | ;options = verbose 16 | ; 17 | ; Functions to trace. 18 | ; 19 | traces = hello-trace 20 | ; 21 | ; Define the function sets. These are the function's that can be 22 | ; added to the trace lists. 23 | ; 24 | functions = hello-trace 25 | ; 26 | ; Include RTEMS Trace support. 27 | ; 28 | include = rtems.ini, rtld-base.ini 29 | 30 | ; 31 | ; User application trace example. 32 | ; 33 | [hello-trace] 34 | generator = printk-generator 35 | signatures = hello-signatures 36 | trace = exit, Init 37 | header = "#include " 38 | header = "#include " 39 | header = "#include " 40 | 41 | [hello-signatures] 42 | exit=void, int 43 | Init = void, rtems_task_argument 44 | -------------------------------------------------------------------------------- /ticker/ticker_trace/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Joel Sherrill (joel@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'ticker_trace.exe', 14 | source = ['init.c']) 15 | 16 | if rtems.check_env(bld, 'RTEMS_TLD'): 17 | bld(features = 'c rtrace', 18 | target = 'ticker_trace.texe', 19 | source = ['init.c'], 20 | rtrace_cfg = '../../ticker/ticker_trace/ticker.ini', 21 | rtrace_wrapper = 'ticker-test') 22 | bld(features = 'c rtrace', 23 | target = 'ticker_trace-deep.texe', 24 | source = ['init.c'], 25 | rtrace_cfg = '../../ticker/ticker_trace/ticker-deep.ini', 26 | rtrace_wrapper = 'ticker-deep') 27 | -------------------------------------------------------------------------------- /ticker/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse(['ticker', 10 | 'ticker_stackchk', 11 | 'ticker_trace', 12 | 'low_ticker', 13 | 'low_ticker1', 14 | 'low_ticker2']) 15 | 16 | -------------------------------------------------------------------------------- /uboot/Makefile: -------------------------------------------------------------------------------- 1 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 2 | include $(RTEMS_CUSTOM) 3 | include $(RTEMS_SHARE)/make/directory.cfg 4 | 5 | SUBDIRS = uboot_getenv 6 | -------------------------------------------------------------------------------- /uboot/uboot_getenv/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # RTEMS_MAKEFILE_PATH is typically set in an environment variable 3 | # 4 | 5 | EXEC=uboot_getenv.exe 6 | PGM=${ARCH}/$(EXEC) 7 | 8 | # C source names 9 | CSRCS = test.c 10 | COBJS = $(CSRCS:%.c=${ARCH}/%.o) 11 | 12 | include $(RTEMS_MAKEFILE_PATH)/Makefile.inc 13 | include $(RTEMS_CUSTOM) 14 | include $(PROJECT_ROOT)/make/leaf.cfg 15 | 16 | OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) 17 | 18 | all: ${ARCH} $(PGM) 19 | 20 | $(PGM): $(OBJS) 21 | $(make-exe) 22 | -------------------------------------------------------------------------------- /uboot/uboot_getenv/README: -------------------------------------------------------------------------------- 1 | # 2 | # README for U-Boot getenv() demo 3 | # 4 | 5 | Some boards on which RTEMS runs have U-Boot. If the BSP supports 6 | it, then you may obtain environment variables which U-Boot has stored 7 | in Flash. 8 | -------------------------------------------------------------------------------- /uboot/uboot_getenv/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple test program -- simplified version of sample test hello. 3 | */ 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #if defined(HAS_UBOOT) 11 | void test_getenv( 12 | const char *name 13 | ) 14 | { 15 | const char *bsp_uboot_getenv( 16 | const char *name 17 | ); 18 | const char *rhs = bsp_uboot_getenv( name ); 19 | 20 | printf( "%s=%s\n", name, ((rhs) ? rhs : NULL)); 21 | } 22 | #endif 23 | 24 | rtems_task Init( 25 | rtems_task_argument ignored 26 | ) 27 | { 28 | puts( "\n\n*** U-Boot Get Environment Variable Test ***" ); 29 | #if defined(HAS_UBOOT) 30 | test_getenv( "ipaddr" ); 31 | test_getenv( "baudrate" ); 32 | test_getenv( "bootcmd" ); 33 | test_getenv( "badname" ); 34 | #else 35 | puts( "This BSP does not have U-Boot." ); 36 | #endif 37 | puts( "*** END of U-Boot Get Environment Variable Test ***" ); 38 | 39 | exit( 0 ); 40 | } 41 | 42 | /* configuration information */ 43 | 44 | /* NOTICE: the clock driver is explicitly disabled */ 45 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 46 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 47 | 48 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 49 | 50 | #define CONFIGURE_MAXIMUM_TASKS 1 51 | 52 | #define CONFIGURE_INIT 53 | 54 | #include 55 | 56 | /* end of file */ 57 | -------------------------------------------------------------------------------- /uboot/uboot_getenv/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | # Waf build script for an RTEMS Hello 7 | import rtems_waf.rtems as rtems 8 | 9 | def build(bld): 10 | rtems.build(bld) 11 | 12 | bld(features = 'c cprogram', 13 | target = 'uboot_getenv.exe', 14 | source = ['test.c']) 15 | 16 | -------------------------------------------------------------------------------- /uboot/wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Gedare Bloom (gedare@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | import rtems_waf.rtems as rtems 7 | 8 | def build(bld): 9 | bld.recurse('uboot_getenv') 10 | 11 | -------------------------------------------------------------------------------- /waf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RTEMS/rtems-examples/47e727d3d32b806326bfa365b900f7ae72a53ea8/waf -------------------------------------------------------------------------------- /wscript: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Chris Johns (chrisj@rtems.org) 2 | # 3 | # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. 4 | # 5 | 6 | from __future__ import print_function 7 | 8 | # See README.waf for building instructions. 9 | 10 | rtems_version = "7" 11 | 12 | try: 13 | import rtems_waf.rtems as rtems 14 | import rtems_waf.rtems_bsd as rtems_bsd 15 | except: 16 | print('error: no rtems_waf git submodule; see README.waf') 17 | import sys 18 | sys.exit(1) 19 | 20 | def init(ctx): 21 | rtems.init(ctx, version = rtems_version, long_commands = True) 22 | 23 | def bsp_configure(conf, arch_bsp): 24 | rtems_bsd.bsp_configure(conf, arch_bsp, mandatory = False) 25 | conf.recurse('lvgl') 26 | 27 | def options(opt): 28 | rtems.options(opt) 29 | rtems_bsd.options(opt) 30 | 31 | def configure(conf): 32 | rtems.configure(conf, bsp_configure = bsp_configure) 33 | 34 | def build(bld): 35 | rtems.build(bld) 36 | bld.env.CFLAGS += ['-O2','-g'] 37 | bld.recurse('hello') 38 | bld.recurse('gdb') 39 | bld.recurse('filesystem/fat_ramdisk') 40 | bld.recurse('classic_api') 41 | bld.recurse('file_io') 42 | bld.recurse('ticker') 43 | bld.recurse('uboot') 44 | bld.recurse('led') 45 | bld.recurse('misc') 46 | bld.recurse('benchmarks') 47 | bld.recurse('micromonitor') 48 | bld.recurse('posix_api') 49 | bld.recurse('cxx') 50 | bld.recurse('c11') 51 | bld.recurse('lvgl') 52 | 53 | def rebuild(ctx): 54 | import waflib.Options 55 | waflib.Options.commands.extend(['clean', 'build']) 56 | 57 | def tags(ctx): 58 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) 59 | --------------------------------------------------------------------------------