Commit 4d07d0a8 authored by dimonov's avatar dimonov
Browse files

initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
Compiling monartis-enhanced openQNX
-----------------------------------
In order to compile QNX, you have to install Momentics (6.4.0 is ok) locally, because some of files required by the OS
are not in the basic kernel (recall that openQNX follows a microkernel architecture, and some parts like
file systems, drivers, etc. do not belong to the kernel).
Then, the files qnx_env and qconf_override_mk must be adapted accordingly.
1) change dir to trunk
2) compilation for x86 and nto (neutrino)
make CPULIST=x86 OSLIST=nto hinstall
make CPULIST=x86 OSLIST=nto install
3) using QNX with QEMU
- Use the build_cmd(_with_create for the first time) script to create an image
- Type qemu -hda qnxfs.img
#qemu-img create qnxfs.img 1M
mkifs -r stage -vv qemu-minimal.build qnx.ifs
dinit -H -R -f qnx.ifs qnxfs.img
dinit -B pc2 qnxfs.img
qemu-img create qnxfs.img 100M
mkifs -r stage -vv qemu-minimal.build qnx.ifs
dinit -H -R -f qnx.ifs qnxfs.img
dinit -B pc2 qnxfs.img
USE_INSTALL_ROOT=1
INSTALL_ROOT_nto=/realtime/monartis/src/openqnx/stage
VERSION_REL=6.4.0
#
# The build file for QNX Neutrino booting on QEMU standard PC
# Absolute mimimal config for a shell, networking and ftp
#
[virtual=x86,bios +compress] boot = {
startup-bios -s64k
[+keeplinked]
PATH=/proc/boot:/bin:/usr/bin LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll procnto
}
[+script] startup-script = {
display_msg " "
display_msg "Welcome to QNX Neutrino 6.4.0 inside QEMU!"
display_msg " "
procmgr_symlink ../../proc/boot/libc.so.3 /usr/lib/ldqnx.so.2
display_msg "---> Starting PCI Services"
pci-bios
waitfor /dev/pci
display_msg "---> Starting EIDE Driver"
devb-eide blk cache=64M,auto=partition,vnode=2000,ncache=2000,noatime,commit=low dos exe=all
waitfor /dev/hd0
# Mount disk as /
# Also, mount CD rom
display_msg "---> Mounting Filesystems"
mount /dev/hd0 /
mount -tcd /dev/cd0 /fs/cd0
#display_msg "---> Starting io-pkt-v4"
#io-pkt-v4 -dne2000 -ptcpip
#waitfor /proc/boot/io-pkt-v4
#display_msg "---> Registering with DHCP"
#dhcp.client
# Some common servers
pipe &
mqueue &
devc-pty &
#### Chose either console or serial port (or BOTH using [+session])
display_msg "---> Starting Console Manager"
devc-con &
reopen /dev/con1
#display_msg "---> Starting Serial Manager"
#devc-ser8250 -e -b115200 &
#reopen /dev/ser1
display_msg "---> Starting esh"
esh
}
libc.so
libcam.so
io-blk.so
cam-disk.so
fs-qnx4.so
cam-cdrom.so
fs-cd.so
libsocket.so.2
devn-ne2000.so
#npm-tcpip.so
[data=c]
pipe
mqueue
devc-pty
io-pkt-v4
pci-bios
devb-eide
esh
devc-con
devc-ser8250
ls
cat
mount
ifconfig
#dhcp.client
ping
pci
slay
pidin
qconn
tftp
tftpd
mkdir
mt_metadata
mt_logger
File added
export QNX_BASE=/xen/qnx640
export QNX_TARGET=$QNX_BASE/target/qnx6
export PATH=$PATH:$QNX_BASE/host/linux/x86/usr/bin
export QNX_HOST=$QNX_BASE/host/linux/x86
export MAKEFLAGS=-I$QNX_TARGET/usr/include
export MKFILES_ROOT=$QNX_TARGET/usr/include/mk/
export QCONF_OVERRIDE=/realtime/monartis/src/openqnx/qconf-override.mk
File added
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>trunk</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>
LIST=ALL
EARLY_DIRS=lib
LATE_DIRS=apps mme
include recurse.mk
LIST=APPS
include recurse.mk
#
# Copyright 2001, QNX Software Systems Ltd. All Rights Reserved
#
# This source code has been published by QNX Software Systems Ltd. (QSSL).
# However, any use, reproduction, modification, distribution or transfer of
# this software, or any software which includes or is based upon any of this
# code, is only permitted under the terms of the QNX Community License version
# 1.0 (see licensing.qnx.com for details) or as otherwise expressly authorized
# by a written license agreement from QSSL. For more information, please email
# licensing@qnx.com.
#
ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)
define PINFO
PINFO DESCRIPTION=POSIX pipe daemon
endef
EXTRA_CCDEPS = $(wildcard $(PROJECT_ROOT)/*.h) $(PROJECT_ROOT)/common.mk
CCFLAGS += -D_FILE_OFFSET_BITS=64 -D_IOFUNC_OFFSET_BITS=64
INSTALLDIR=sbin
USEFILE=$(PROJECT_ROOT)/$(NAME).c
include $(MKFILES_ROOT)/qtargets.mk
LIST=VARIANT
include recurse.mk
include ../../common.mk
LIST=CPU
include recurse.mk
#
# Copyright 2001, QNX Software Systems Ltd. All Rights Reserved
#
# This source code has been published by QNX Software Systems Ltd. (QSSL).
# However, any use, reproduction, modification, distribution or transfer of
# this software, or any software which includes or is based upon any of this
# code, is only permitted under the terms of the QNX Community License version
# 1.0 (see licensing.qnx.com for details) or as otherwise expressly authorized
# by a written license agreement from QSSL. For more information, please email
# licensing@qnx.com.
#
ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)
INSTALLDIR=usr/sbin
define PINFO
PINFO DESCRIPTION=RealTime application
endef
USEFILE=$(PROJECT_ROOT)/other_rt.use
include $(MKFILES_ROOT)/qtargets.mk
../../apps/rtapp/other_rt.c
\ No newline at end of file
Usage is not available yet.
LIST=VARIANT
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif
include $(QRDIR)$(QRECURSE)
#LIST=CPU
include recurse.mk
#
# Copyright 2001, QNX Software Systems Ltd. All Rights Reserved
#
# This source code has been published by QNX Software Systems Ltd. (QSSL).
# However, any use, reproduction, modification, distribution or transfer of
# this software, or any software which includes or is based upon any of this
# code, is only permitted under the terms of the QNX Community License version
# 1.0 (see licensing.qnx.com for details) or as otherwise expressly authorized
# by a written license agreement from QSSL. For more information, please email
# licensing@qnx.com.
#
ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)
INSTALLDIR=usr/sbin
define PINFO
PINFO DESCRIPTION=Metadata file generator
endef
USEFILE=$(PROJECT_ROOT)/mt_metadata.use
include $(MKFILES_ROOT)/qtargets.mk
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Authors: Jerome Stadelmann (JSN), Pietro Descombes (PDB), Daniel Rossier (DRE)
Emails: <firstname.lastname@heig-vd.ch>
Copyright (c) 2009 Reconfigurable Embedded Digital Systems (REDS) Institute from HEIG-VD, Switzerland
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/time.h>
#include "mt_metadata.h"
#include <string.h>
#include <sys/syspage.h>
#include <sys/neutrino.h>
#include <inttypes.h>
char *fname = "metadata_0";
int metafic;
struct timeval mt_meta_time;
uint64_t clk_cycles;
/** here are defined all events of the kernel (file kernel_[n]) */
void * mt_meta_ker_events (void *pt0) {
/* usage
* _mt_meta_KER_EVENT(id, name, format);
* or :
* char next_id = 1;
* _mt_meta_KER_EVENT(next_id++, name, format);
*/
/* This dummy_check trace contains no information besides the timestamp.
* Its purpose is to measure delay between two consecutive tracing calls
* using timestamps to quantify intrusive factor and delay due to tracing.
*/
_mt_meta_KER_EVENT(0, "dummy_check", "");
/* task/thread events */
_mt_meta_KER_EVENT(1, "task_create", "pid %u tid %u priority %c");
_mt_meta_KER_EVENT(2, "task_suspend", "pid %u tid %u");
_mt_meta_KER_EVENT(3, "task_resume", "pid %u tid %u");
_mt_meta_KER_EVENT(4, "task_delete", "pid %u tid %u status %d");
_mt_meta_KER_EVENT(5, "task_periodicity", "pid %u tid %u period %llu");
_mt_meta_KER_EVENT(6, "task_priority", "pid %u tid %u priority %c");
_mt_meta_KER_EVENT(7, "task_info", "pid %u tid %u state %c priority %c");
_mt_meta_KER_EVENT(9, "task_cycle_done", "pid %u tid %u");
/* semaphore events */
_mt_meta_KER_EVENT(10, "sem_init", "&sem %p value %d pid %u tid %u");
_mt_meta_KER_EVENT(11, "sem_P", "&sem %p value %d pid %u tid %u");
_mt_meta_KER_EVENT(12, "sem_V", "&sem %p value %d pid %u tid %u");
_mt_meta_KER_EVENT(13, "mutex_init", "&mutex %p pid %u tid %u");
_mt_meta_KER_EVENT(14, "mutex_lock", "&mutex %p pid %u tid %u owner %u");
_mt_meta_KER_EVENT(15, "mutex_unlock", "&mutex %p pid %u tid %u owner %u");
_mt_meta_KER_EVENT(19, "sync_destroy", "&sync %p value %d pid %u tid %u");
/* IRQ events */
_mt_meta_KER_EVENT(20, "IRQ_entry", "irq %u");
_mt_meta_KER_EVENT(21, "IRQ_exit", "irq %u");
_mt_meta_KER_EVENT(22, "IRQ_handler_entry","irq %u");
_mt_meta_KER_EVENT(23, "IRQ_handler_exit", "irq %u");
_mt_meta_KER_EVENT(24, "IRQ_timer_entry", "");
_mt_meta_KER_EVENT(25, "IRQ_timer_exit", "");
/* Event for debug: used to see which function and line emitted next trace,
* and allows to display some text.
*/
_mt_meta_KER_EVENT(0xFFFE,"var_debug", "val1 %u val2 %u val3 %p");
_mt_meta_KER_EVENT(0xFFFF,"debug", "calling_function %s line %u text %s");
return pt0;
}
int main () {
void *ptbeg, *ptend;
ltt_subbuffer_header_t *pthd;
size_t fsize;
ptbeg = malloc(4*1024);
if (ptbeg == NULL)
perror("allocation went wrong\b");
ptend = ptbeg;
pthd = (ltt_subbuffer_header_t *) ptbeg;
/* write the binary */
ptend = mt_meta_write_header(ptend);
ptend = mt_meta_events(ptend);
ptend = mt_meta_ker_events(ptend);
remove(fname);
/* file open */
if((metafic = open(fname, O_WRONLY /*| O_APPEND*/ | O_CREAT,
S_IRUSR|S_IWUSR | S_IRGRP | S_IROTH)) == -1) {
printf("USR Cannot open file '%s'.\n", fname);
exit(1);
}
if (ptbeg != pthd)
printf("pointers are not the same!\n");
fsize = (ptend - ptbeg);
printf("size = %u (header size = %u)\n", fsize, sizeof(ltt_subbuffer_header_t));
pthd->buf_size = fsize;
write (metafic, ptbeg, fsize);
close(metafic);
free(ptbeg);
return 0;
}
/**
* redefines the metadata events
* begins the writing at start pointer pt0, and returns end pointer
*/
void * mt_meta_events (void *pt0) {
uint8_t *pt1;
uint16_t *pt2;
/* event marker id (id29) */
/* header 26 */
/* "metadata":9 "core_marker_id":15 24+7=26 */
pt0 = mt_meta_write_id29(pt0, 0, 26);
/* marker id 0 */
_incr_strcpy(pt0, "metadata");
_incr_strcpy(pt0, "core_marker_id");
pt2 = (uint16_t *) pt0;
*(pt2++) = 0; /* id */
pt1 = (uint8_t *) pt2;
*(pt1++) = sizeof(int);
*(pt1++) = sizeof(long);
*(pt1++) = sizeof(void *);
*(pt1++) = sizeof(size_t);
*(pt1++) = ALIGNMENT; /* alignement */
pt0 = pt1;
/* marker format 1 */
pt0 = mt_meta_write_id(pt0, 1);
_incr_strcpy(pt0, "metadata");
_incr_strcpy(pt0, "core_marker_id");
_incr_strcpy(pt0, "channel %s name %s event_id %hu int #1u%zu long #1u%zu pointer #1u%zu size_t #1u%zu alignment #1u%u");
/* event marker format */
pt0 = mt_meta_write_id(pt0, 0);
_incr_strcpy(pt0, "metadata");
_incr_strcpy(pt0, "core_marker_format");
pt2 = pt0;
*(pt2++) = 1; /* id */
pt1 = (uint8_t *) pt2;
*(pt1++) = sizeof(int);
*(pt1++) = sizeof(long);
*(pt1++) = sizeof(void *);
*(pt1++) = sizeof(size_t);
*(pt1++) = ALIGNMENT; /* alignment */
pt0 = pt1;
/* marker format 1 */
pt0 = mt_meta_write_id(pt0, 1);
_incr_strcpy(pt0, "metadata");
_incr_strcpy(pt0, "core_marker_format");
_incr_strcpy(pt0, "channel %s name %s format %s");
return pt0;
}
/**
* writes the event definition (any non-metadata event)
* called from mt_meta_ker_events
*/
void * mt_meta_event(void *pt0, char *channel, char *name, unsigned short id, char *format) {
uint8_t *pt1;
uint16_t *pt2;
printf("id = %u, channel = %s, name = %s, format = %s\n", id, channel, name, format);
/* 0 */
pt0 = mt_meta_write_id(pt0, 0);
_incr_strcpy(pt0, channel);
_incr_strcpy(pt0, name);
pt2 = pt0;
*(pt2++) = id; /* id */
pt1 = (uint8_t *) pt2;
*(pt1++) = sizeof(int);
*(pt1++) = sizeof(long);
*(pt1++) = sizeof(void *);
*(pt1++) = sizeof(size_t);
*(pt1++) = ALIGNMENT; /* alignment */
pt0 = pt1;
/* 1 */
pt0 = mt_meta_write_id(pt0, 1);
_incr_strcpy(pt0, channel);
_incr_strcpy(pt0, name);
_incr_strcpy(pt0, format);
return pt0;
}
/** writes the 32 bit event header (id & small timestamp) */
void * mt_meta_write_id(void *pt0, unsigned short id) {
/* only events 0 and 1 will be found in metadata,
* no need for further check*/
uint32_t both, temp;
uint32_t *pt4;
clk_cycles = ClockCycles();