Home

System Configuration Guide

image

Contents

1. MAPUS QFT MAPUS QFT OS Abstractor ANSI API Mapping OS Abstractor APIs can be mapped to exact ANSI names by turning on these features Table 2_14 OS Abstractor ANSI API Mapping System Configuration Guide Flag and Purpose Available options MAP_OS_ANSI_MEMORY OS TRUE map ANSI malloc and free to OS Abstractor equivalent functions OS FALSE do not map functions Also when you call OS_Application_Free in this case the memory allocated via malloc calls will NOT be automatically freed The default value is OS_TRUE NOTE Refer to OS_USE_EXTERNAL_MALLOC define if you want to connect your own memory management solution for use by OS Abstractor MAP OS ANSI FMT IO OS TRUE map ANSI printf and sprintf to OS Abstractor equivalent functions OS FALSE do not map functions The default value is OS_FALSE MAP OS ANSI IO OS TRUE map ANSI device I O functions like open close read write ioctl etc to OS Abstractor equivalent functions NOTE If your target OS is NOT a single memory model based e g Windows Linux QNX etc then the OS Abstractor I O functions are to be used within one single process application If you need to use the I O across multiple process then set this define to OS_FALSE so that your application can use the native I O APIs from the OS OS FALSE do not map functions The default value is OS_FALSE NOTE When you set MAP_OS_ANSI_IO to OS_T
2. Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_THREADX To include ThreadX Interface product Refer to the appropriate Interface manual for more details OS_TRUE Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_FILE To include ANSI file system API compliance for the vendor provided File Systems Refer to the appropriate Interface manual for more details OS_TRUE Include support OS FALSE Do not include support The default is OS_FALSE This option is only available for Nucleus PLUS target OS INCLUDE_OS_WINDOWS To include Windows Interface product Refer to the appropriate Interface manual for more details OS_TRUE Include support OS FALSE Do not include support The default is OS_FALSE This option is not available on Windows operating system host or target environment MAPUS FT MAPUS QFT NOTE For additional information regarding how to use any specific Interface product refer to the appropriate reference manual or contact www mapusoft com System Configuration Guide POSIX OS Abstractor Selection OS Abstractor Interface optionally comes with POSIX support as well Set the pre processor flag provided below to select the POSIX component for application use as follows Table 2_8 POSIX component for application Flag and Purpose Available Options INCLUDE_OS_POSIX OS TRUE Include s
3. MAPUS QFT OS Abstractor Target OS Specific Notes Nucleus PLUS Target The following is the compilations define that has to be set when building the Nucleus PLUS library in order for the OS Abstractor to perform correctly System Configuration Guide Table 2_21 Compilation Flag For Nucleus PLUS Target Compilation Flag Meaning NU_DEBUG Regardless of the target you build the OS Abstractor library always requires this flag to be set in order to be able to access OS internal data structures Without this flag you will see a lot of compiler errors ThreadX Target The ThreadX port for Win32 has a user defined memory ceiling which has a default value of 64K If you run into issues with memory not being available you will need to increase the memory limit This define is called TX WIN32 MEMORY SIZE and is located in tx_port h Precise MQX Target The following are the compilation defines that has to be set if you are using Precise MQX as your target OS Table 2 22 Compilation Flag for Precise MQX Target Compilation Flag Meaning MQX_TASK_DESTRUCTION Set this macro to zero to allow OS Abstractor to manage destruction of MQX kernel objects such as semaphores BSP DEFAULT MAX MSGPO Set this macro to match the maximum OLS number of message queues and pipes required by your application at a given time For example if your application would need a max of 10 message queues and 10 pipes then this macro need
4. MAPUS QFT Chapter 3 Ada System Configuration System Configuration Guide Interfacing to C and Machine Code This section explains how to interface between Ada code and C and machine code The Ada compiler generates C code which is compiled by the C compiler into machine language Therefore most machine level details require some understanding of the conventions used by the C compiler Before reading this section please read the sections of the C compiler manual that refer to interfacing between C and assembly language You will need to understand the calling conventions data layout conventions and so forth documented there In order to write machine code inserts you need to understand your target s hardware architecture Data Layout Ada types are converted into corresponding C types In most cases the correspondence is simple An Ada array becomes a C array starting at zero An Ada record becomes a C struct with the fields in the same order Ada Integer becomes int modular becomes unsigned Character becomes char and enumerations become enum See the C compiler documentation for information about the layout of these types Packed Arrays The effect of Pragma Pack on an array type is to cause packing of discrete type array elements into 8 bit bytes The component size used is the smallest divisor of 8 which is greater than or equal to the component size with any leftover bits spread evenly into each component For example
5. Note Every process needs a memory pool only for uCOS Target NON_PROCESS e 1 Event Group required by OS Abstractor for Linux Windows MQX Target 2 Event Group required by OS Abstractor uCOS Target PARTITION_POOL 1 Semaphore is used by OS Abstractor for above mentioned target PROTECTION_STRUCTURE 1 Protection Structures required by os_key_list_protect if application uses POSIX Interface for above mentioned target 14 Additional Protection Structure required by OS Abstractor for above mentioned Targets except LynxOS Target Vxworks amp QNX Target MAPUS QFT MAPUS FT System Configuration Guide 13 Additional Protection Structure required by OS Abstractor for LynxOS Target Vxworks amp QNX Target 1 Event Group required by POSIX Interface for above mentioned target 1 Event Group required by POSIX Interface for above mentioned target 1 Semaphore required by POSIX Interface for above mentioned target Posix Condition Variable Posix R W Lock If INCLUDE OS PROCESS feature is set to OS FALSE then the memory will be allocated from the individual application process specific pool which gets created during the OS Application Init function call If INCLUDE OS PROCESS is set to OS TRUE then the memory is allocated from a shared memory region to allow applications to communicate across multiple processes Please note that in this case the control block allocations cannot be don
6. This guide e Explains how to use pSOS Classic interface port applications Nucleus Interface Reference Manual Provides detailed description of how to get started with Nucleus interface support that MapuSoft provides This guide MAPUS QFT MAPUS QFT System Configuration Guide e Explains how to use Nucleus interface port applications ThreadX Interface Reference Provides detailed description of how to get started Manual with ThreadX interface support that MapuSoft provides This guide Explains how to use ThreadX interface port applications VxWorks Interface Reference Provides detailed description of how to get started Manual with VxWorks Interface support that MapuSoft provides This guide Explains how to use VxWorks Interface port applications Windows Interface Reference Provides detailed description of how to get started Manual with Windows interface support that MapuSoft provides This guide e Explains how to use Windows interface port applications Release Notes Provides the updated release information about MapuSoft Technologies new products and features for the latest release This document e Gives detailed information of the new products e Gives detailed information of the new features added into this release and their limitations if required MAPUS QFT MAPUS FT Requesting Support Technical support is available through the MapuSoft Technologies Suppo
7. This is deallocated before leaving the function call e Message in rcv_mbf This is deallocated before leaving the function call e Message in prcv_mbf This is deallocated before leaving the function call MAPUS QFT MAPUS QFT System Configuration Guide e Message in trev_mbf This is deallocated before leaving the function call VxWorks Interface All of the following allocations use OS_Allocate_Memory using the System_Memory pool Thus all these allocations come from the calling processes memory pool e Wdcreate allocates memory for an OS TIMER control block e Message in msgqsend This is deallocated before leaving the function call e Message in msgqreceive This is deallocated before leaving the function call pSOS Interface All of the following allocations use OS_Allocate_Memory using the System_Memory pool Thus all these allocations come from the calling processes memory pool e Rn _getseg will allocate from the System Memory if a pool is not specified e Message in q_vsend This is deallocated before leaving the function call e Message in q_vrecieve This is deallocated before leaving the function call e Message in q_vurgent This is deallocated before leaving the function call All of the following allocations use malloc Depending on the setting of OS_MAP_ANSI_MEM these may or may not be accounted for in the process memory pool e IOPARMS structure in de close e IOPARMS structure in de_cntrl e IOPARMS st
8. To include VxWorks Interface product Refer to the appropriate Interface manual for more details OS TRUE Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_POSIX LINUX To include POSIX LINUX Interface product Refer to the appropriate Interface manual for more details OS_TRUE Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_PSOS To include pSOS Interface product Refer to the appropriate Interface manual for more details OS TRUE Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_PSOS_CLASSIC To include a very old version of pSOS Interface product Refer to the appropriate Interface manual for more details OS TRUE rev 3 10 1986 OS FALSE do not include pSOS 4 1 support The default is OS FALSE Include support for pSOS 4 1 INCLUDE OS UITRON To include UITRON Interface product Refer to the appropriate Interface manual for more details OS TRUE Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_NUCLEUS To include Nucleus PLUS Interface product Refer to the appropriate Interface manual for more details OS_TRUE Include support OS FALSE Do not include support The default is OS_FALSE INCLUDE_OS_NUCLEUS_NET To include Nucleus NET Interface product Refer to the appropriate Interface manual for more details OS_TRUE
9. Tracing the Call Stack The debugger s stack trace back command is generally useful However sometimes it is necessary to track the stack manually To do that you will need to know the target calling conventions In an interrupt handler there may be different calling conventions used by the target hardware or operating system MAPUS QFT MAPUS QFT Revision History System Configuration Guide Document Title System Configuration Guide Release Number 1 3 9 Release Revision Orig of Description of Change Change 1 3 5 0 1 VV New document Updated UITRON with micro ITRON Added revision history Renamed Getting started to Programmers Guide Changed the Programmers Guide description on page 8 Modified the Release number Added the SMP Flag information Added Android Specific notes Added Ada System Configuration Modified the Release number Modified the Release number Added the Threadx Interface Added the Threadx Target Added SMP Flag Limitation Copyright 2014 MapuSoft Technologies Inc All Rights Reserved The information contained herein is subject to change without notice The materials located on the Mapusoft MapuSoft web site are protected by copyright trademark and other forms of proprietary rights and are owned or controlled by MapuSoft or the party credited as the provider of the information MapuSoft retains all copyrights and other property rights in all text gra
10. if the component size is 3 each component when packed in the array is 4 bits Note that pragma Pack has no effect on the layout of the component type Packed Records The effect of pragma Pack on a record type is to cause scalar components other than floating point to be compressed so that they occupy the smallest number of bits appropriate to values of those types Sub word sized items will be combined into a single word packed starting at the next available bit but never to extend across a word boundary If an item is word sized or larger it will start and end on a word boundary Bit numbering starts with zero at the low order end of words Interface to C Since the compiler generates C it is relatively straightforward to interface to C Refer to RM B 3 for information about the language defined mechanisms An example version of package Interfaces C may be found in the distribution in the RTS or RTL subdirectory You can use the ke switch to tell the Ada compiler to keep the C code after compiling it and you can look at the C code to determine what names and so forth were chosen MAPUS QFT MAPUS QFT Machine Code Inserts System Configuration Guide Ada provides two mechanisms for doing machine code inserts Code statements and Intrinsics AdaMagic supports the more powerful of the two mechanisms intrinsics Code statements and the corresponding package System Machine_Code are not supported The C compiler sup
11. Boolean False end Handler PO end Interrupt_Test With Entries Handlers package body Interrupt Test With Entries Handlers protected body Handler PO is procedure Handler is begin Interrupt Occurred True end Handler entry Await Interrupt when Interrupt Occurred is begin MAPUS QFT MAPUS FT Interrupt Occurred False System Configuration Guide end Await Interrupt end Handler PO end Interrupt_Test With Entries Handlers package Interrupt Test With Entries Waiting Tasks is pragma Elaborate Body So the body is allowed end Interrupt_Test With Entries Waiting Tasks upt Test With Entries Handlers Interrupt Test With Entries Handlers package body Interrupt Test With Entries Waiting Tasks is task Waiting Task task body Waiting Task is begin for I in 1 10 loop Handler PO Await Interrupt Put Line Waiting Task Got interrupt end loop Put_Line Goodbye from Waiting Task end Waiting Task end Interrupt_Test With Entries Waiting Tasks with System Machine Intrinsics with Interrupt Test With Entries Waiting Tasks There are no references to this package this with clause is here so that task Waiting Task will be included in the program procedure Interrupt Test With Entries Main is procedur Generate Interrupt Interrupt Ada Interrupts Interrupt_ID is aS in previo
12. REGION1 SIZE define HOST ROOT PROCESS AFFINITY endif I I I I I I I I PRPPRPRPPRPRB BROOONKFF OOOUI VOID OS Main STATUS sts OS_SUCCESS OS_APP_INIT_INFO info OS_APP_INIT_INFO_INITIALIZER UNSIGNED process id set the OS APP INIT INFO structure with the actual number of resources we will use If we set all the MAPUS FT MAPUS FT System Configuration Guide variables to 1 the default values would be used On ThreadX and Nucleus we must pass an OS APP INIT INFO structure with at least first available set to the first unused memory Other OS s can pass NULL to OS Application Init and all defaults would be used if OS_HOST OS_TRUE Initialize the info structure During the optimization process the wizard will create a custom cross os usr h with these values set to the values you specify at that time so this structure will not be necessary on the target system debug info task_pool_timeslice task pool timeout root_process preempt root process priority root process stack size root process heap size default timeslice max tasks max timers max mutexes max pipes max processes max_queues max_partition_mem_pools max_dynamic_mem_pools max_event_groups max_semaphores max_protection_structs user_shared_region1_size task_pool_enabled affinity_mask endif if OS_TARGET info pool pool endif sts OS_THREADX OS_TARGET HOST_DEBUG_INFO HOST_T
13. Set to True for each interrupt end Suspension_Objects_Test Handlers package body Suspension_Objects_Test Handlers is protected body Handler_PO is procedure Handler is MAPUS QFT MAPUS QFT begin System Configuration Guide Set_True Interrupt_Occurred end Handler end Handler_PO end Suspension_Objects_Test Handlers package Suspension_Objects_Test Waiting Tasks is pragma Elaborate_Body So the body is allowed end Suspension_Objects_Test Waiting Tasks with Suspension_Objects_Test Handlers use Suspension_Objects_Test Handlers with Ada Synchronous_Task_Control use Ada Synchronous_Task_Control package body Suspension_Objects_Test Waiting Tasks is task Waiting Task task body Waiting Task is begin for I in 1 4 loop Suspend_Until_True Interrupt_Occurred Put Line Waiting Task Got interrupt end loop Put_Line Goodbye from Waiting Task end Waiting Task end Suspension_Objects_Test Waiting Tasks with System Machine_Intrinsics with Suspension_Objects_Test Waiting Tasks There are no references to this package this with_clause is here so that task Waiting_Task will be included in the program procedure Suspension_Objects_Test Main is procedure Generate_Interrupt Interrupt Ada Interrupts Interrupt_ID is aS in previous example end Generate_Interrupt begin Generate some simulated interrupts with delays in between Put_Line Hello from Suspension_Objects_Tes
14. Suspended_On null means thread is suspended Defer_count gt O means is abort deferred 9 Pending abort level Normally 2 31 1 MAPUS FT MAPUS QFT The field Suspended_On contains a non null address when the corresponding Ada task is suspended The target of the pointer is the Suspension Object on which the task is suspended System Configuration Guide To set a breakpoint for when a task is about to suspend set it at System _Rts_Tgt_Kernel Threads Suspend until true or timeout NOTE This is case sensitive The parameters to this routine are the pointer to the Suspension Object and the maximum time in ticks the task will wait To set a breakpoint for when a task ends set it at System Rts Task termination pkg Terminate task The only parameter to this routine is the completion status which is either Completed_normally 1 or Unhandled_exception 4 To set a breakpoint for when a task is aborted set it at System Rts Master pkg Abort self The only parameter to this routine is the abort level where zero means abort completely and gt O means abort to the asynchronous select statement at the corresponding level of dynamic nesting To set a breakpoint for when the main subprogram ends either because it is complete or because of an unhandled exception set it at ada_ fini This routine performs any necessary finalization and then returns allowing the target program to exit
15. Variable Display in a C debugger Nested Subprograms and Up level References Setting Break Points Stopping when an Exception is raised Generics and Inlines Tasking related Symbols and Breakpoints Tracing the Call Stack Revision History 76 System Configuration Guide MAPUS QFT MAPUS QFT List of Tables System Configuration Guide Table 1_1 Notice Icons Table 1_2 Text and Syntax Conventions Table 1_3 Document Description Table Table 2_1 Set the Pre processor Definition For Selected Target OS Table 2_2 Select the host operating system Table 2_3 Select the Target CPU type Table 2_4 OS Changer components for your application Table 2_5 Set the Pre processor Definition For error checking Table 2_6 Cross_os_usr h Configuration File Table 2_7 OS Changer Components Selection Table 2_8 POSIX component for application Table 2_9 OS Abstractor Process Feature Selection Table 2_10 OS Abstractor Task Pooling Feature Selection Table 2_11 OS Abstractor Profiler Feature Selection Table 2_12 OS Abstractor Output Device Selection Table 2_13 OS Abstractor Debug and Error Checking Table 2_14 OS Abstractor ANSI API Mapping Table 2_15 OS Abstractor External Memory Allocation Table 2_16 OS Abstractor system resource configuration parameters Table 2_17 Additional resources required internally by OS Abstractor Table 2_18 OS Abstractor Minimum Memory Pool Block Configuration Table 2_19 OS Abstractor Application Share
16. are passed by reference for interface C subprograms unless the convention is specified explicitly with a pragma Convention C_Pass_By Copy pragma Revision static string expression This pragma is allowed wherever any pragma is allowed The static_string_expression is intended to contain a revision number for the current compilation unit This pragma currently has no effect At some future date it will include the revision as a string in the generated code pragma Suppress Aggregate Temps This pragma causes compiler generated temporary variables to be suppressed in an assignment statement where the right hand side is an aggregate such as X The generated code will build the aggregate directly in the target which is more efficient than using a temp Note This pragma is dangerous In particular if the right hand side overlaps the target as in this example X This gt X That That gt X This the compiler will generate incorrect code Without the pragma the compiler can sometimes avoid the temp but only in those cases where the compiler is smart enough to prove the absence of overlapping This pragma is a configuration pragma which means that you may place it at the top of a source file in which case it applies to the units in that file or you may place it in a pragmas only file in which case it applies to the entire program library In addition there is a compiler switch suppress_aggrega
17. library is built to run as application module Under OS_VXWORKS_6X you have the option to create the library for either as a kernel module or a user application as below OS USER MODE OS TRUE for application module OS USER MODE OS FALSE for kernel module OS KERNEL MODE Set this value to OS TRUE if the OS Abstractor is required to run as a kernel module Under OS_VXWORKS_5X the OS KERNEL MODE flag is ignored The library is built to run as a kernel module Under OS_VXWORKS_6X you have the option to create the library for either as a kernel module or a user application as below OS_KERNEL_MODE OS TRUE for kernel module OS KERNEL MODE KOS FALSE for user application OS VXWORKS TARGET Select your appropriate Target platform The value can be OS VXWORKS PPC OS VXWORKS PPC 604 OS VXWORKS X86 OS VXWORKS ARM OS VXWORKS M68K OS VXWORKS MCORE OS VXWORKS MIPS OS VXWORKS SH OS VXWORKS SIMLINUX OS VXWORKS SIMNT OS VXWORKS SIMSOLARIS OS VXWORKS SPARC Unsupported OS Abstractor APIs The following OS Abstractor APIs are not supported as shown below MAPUS QFT MAPUS QFT System Configuration Guide Table 2_25 Unsupported OS Abstractor APIs for VxWorks Target Compilation Flag Unsupported APIs OS_VERSION OS_Delete_Partion_Pool OS VXWORKS SX OS Delete Memory Pool OS Get Semaphore Count OS VERSION OS Set Clock Ticks OS VXWORKS 6X and OS KERNEL MODE OS TRUE OS VERSION OS
18. manually using an account with the proper capabilities enabled or the kernel will need to be modified and rebuilt with the increased number of resources set as a default Time Resolution The value of the system clock ticks is defined by OS TIME RESOLUTION which is retrieved from the Linux system Under Red Hat GNU Linux this is actually 100 this means every tick equals to 10ms However the OS TIME TICK PER SEC could be different under other real time or proprietary Linux distributions Also make sure you modify OS DEFAULT TSLICE value to match with your application needs if necessary By default this value is set for the time slice to be 100ms If the Linux Advanced MAPUS FT MAPUS QFT System Configuration Guide Real Time Feature is present i e the Linux kernel macro LINUX ADV REALTIME 1 then OS Abstractor automatically takes advantage of this feature if present and uses the sched rr set _interval function and sets the application required round robin thread time slice for the OS Abstractor thread If this feature is not present the time slice value for round robin scheduling will be whatever the kernel is configured to Memory Heap OS Abstractor uses the system heap directly to provide the dynamic variable memory allocation The Memory management for the variable memory is best left for the Linux kernel to be handled so OS Abstractor only does boundary checks to ensure that the application does not allocate
19. next larger stack size that is available will be used If there are multiple requests pending a search will be made in FIFO order on the request list when a task is freed to the pool The first request that matches or fulfills the stack requirement will then be fulfilled Refer to the MapuSoft supplied os_application_start c file that came with the MapuSoft s demo application The demo application pre creates a bunch of fixed stack size using STACK_SIZE as defined in cross_os_def h task pool task as shown below if INCLUDE OS TASK POOLING OS TRUE for i 0 i lt Max Threads i OS Add To Task Pool STACK SIZE this is a portion of code in init c STACK SIZE should be changed according to the desired stack size endif Typically applications would need a variety of threads with different stack size If you would like to modify the demo application to use threads with larger or differing stack size make sure you modify the os application start c file according to your needs MAPUS QFT MAPUS QFT System Configuration Guide The OS_Create_Task function will be used to retrieve a task from the task pool This will be accomplished by passing one of the flags OS POOLED TASK WAIT or OS POOLED TASK NOWAIT as a parameter to OS Create Task When a task has completed and either exits falls through itself or gets deleted by another task using the OS Delete Task function the task will automatically be free
20. per thread OS Abstractor ignores this setting and only uses the system default time slice configured for the Linux kernel NOTE Time slice option is NOT supported under micro ITRON NOTE If the time slice value is non zero then under Linux the threads will use Round Robin scheduling using the system default time slice value of Linux If the Linux kernel support LINUX_ADV_REALTIME then the time slice value will be set accordingly NOTE Since the system clock tick resolution may vary across different OS under different target It is recommended that the application use the macro OS TIME TICK PER SEC to derive the timing requirement instead of using the raw system tick value in order to keep the application portable across multiple OS MAPUS QFT MAPUS QFT OS Abstractor Device I O Configuration Table 2_21 OS Abstractor Device I O Configuration System Configuration Guide Flag and Purpose Default Setting NUM_DRIVERS 20 Maximum number of drivers allowed NOTE This excludes the native drivers in the OS Abstractor driver table the system since they do not use the structure OS Abstractor driver table structure NUM_FILES 30 Maximum number of files that can NOTE One control block is used when be opened simultaneously using the an OS Abstractor driver is opened OS Abstractor file control block These settings do not impact the OS structure setting for max number of files EM
21. up in the hierarchy of enclosing subprograms then look for another parent_frame component in the frame record pointed to MAPUS QFT MAPUS QFT System Configuration Guide by the parent_frame parameter and keep following the chain For example a variable called My_Up_Level which is two levels up in the hierarchy would be accessible via this_frame gt parent frame gt My up level Setting Break Points When viewing a source file in the debugger you can set a break point by double clicking on the line of interest This should work whether looking at Ada source C source or disassembly Disassembly is most reliable if you want to stop at a very specific instruction With Ada or C source there is some imprecision in the setting of the break point Watch points generally work with the simulator and don t seem to slow it down significantly given that the simulator is already quite slow Stopping when an Exception is raised By setting a break point at the symbol frts raise the debugger will stop when any exception is raised To set a breakpoint when a run time check fails causing a language defined exception to be raised you can set a break point at rts_raise_constraint_error rts_raise_program_error or rts_raise_storage_error Note that rts_raise_storage_error is only used for primary stack overflow and it bypasses rts_raise itself because of the intricate processing requir
22. APUS FT he first unused memory Other OS s can pass 11 defaults would be used __ SUCCESS APP_INIT_INFO_INITIALIZER During the optimization process the wizard will h with these values set to the values you specify e will not be necessary on the target system HOST_DEBUG_INFO HOST_TASK_POOL_TIMESLICE HOST TASK POOL TIMEOUT HOST ROOT PROCESS PREEMPT HOST ROOT PROCESS PRIORITY HOST ROOT PROCESS STACK SIZE HOST ROOT PROCESS HEAP_SIZE HOST DEFAULT TIMESLICE HOST MAX TASKS HOST MAX TIMERS HOST MAX MUTEXES HOST MAX PIPES HOST MAX PROCESSES HOST MAX QUEUES HOST MAX PARTITION MEM POOLS HOST MAX DYNAMIC MEM POOLS HOST MAX EVENT GROUPS HOST MAX SEMAPHORES HOST MAX PROTECTION STRUCTS HOST USER SHARED REGION1 SIZE MAPUS FT info task pool enabled HOST TASK POOLING info affinity mask HOST_ROOT_PROCESS_AFFINITY endif if OS_TARGET OS_THREADX OS TARGET OS _NUCLEUS info pool pool endif sts OS Application Init amp process id Demo nyu 2 HEAP SIZE amp info if sts OS SUCCESS amp amp sts OS SUCCESS ATTACHED System Configuration Guide OS_Fatal_Error OS_ Main os init c OS ERR SYSTEM NOT INITIALIZED There was an error while initializing Cross OS OS ERR SYSTEM NOT INITIALIZED sts return OS_Library_Init Wait for Application termination OS Application Wait For End VOID OS Ap
23. ASK_POOL_TIMESLICE HOST TASK POOL TIMEOUT HOST ROOT PROCESS PREEMPT HOST ROOT PROCESS PRIORITY HOST ROOT PROCESS STACK SIZE HOST ROOT PROCESS HEAP_SIZE HOST DEFAULT TIMESLICE HOST MAX TASKS HOST MAX TIMERS HOST MAX MUTEXES HOST MAX PIPES HOST MAX PROCESSES HOST MAX QUEUES HOST MAX PARTITION MEM POOLS HOST MAX DYNAMIC MEM POOLS HOST MAX EVENT GROUPS HOST MAX SEMAPHORES HOST MAX PROTECTION STRUCTS HOST USER SHARED REGION1 SIZE HOST TASK POOLING HOST ROOT PROCESS AFFINITY OS NUCLEUS OS Application Init amp process id Demo 3 HEAP_SIZE amp info if sts OS_SUCCESS amp amp sts OS_Fatal_Error OS_ Main os init c l OS SUCCESS ATTACHED OS ERR SYSTEM NOT INITIALIZED There was an error while initializing Cross OS OS ERR SYSTEM NOT INITIALIZED sts return OS Library Init MAPUS FT MAPUS QFT Wait for Application termination OS Application Wait For End System Configuration Guide VOID OS Application Start UNSIGNI pthread t task posix compatibility initialization create the main process and pass in the osc posix main entry function px main OS Posix Init pthread create amp task NULL void px main NULL pthread join task NULL OS Application _Free OS_ APP FREE EXIT OS Application Start int px_main int argc char argv User applic
24. AXPATH 255 Maximum length of the directory path name including the file name NOTE This setting does not impact the for OS Abstractor use excluding the OS setting for the max path file name null char termination MAX FILENAME LENGTH EMAXPATH 1 max chars in filename EOS SMP Flags The following is the compilation defines that can be set when building the OS Abstractor library for SMP kernel target OS Table 2_23 Compilation Flag for SMP Compilation Flag Meaning OS_BUILD_FOR_SMP Specify the SMP or non SMP kernel The value can be OS_TRUE SMP enabled Support for OS FALSE SMP disabled Symmetric Multi Processors SMP Warning If you fail to set SMP flag to OS_TRUE and use Mapusoft products on an SMP enabled machine you will get the result in an unpredictable behavior due to failure of internal data protection mechanism Now MapuSoft provides SMP support to the following OS s e Linux e Windows XP Vista Mobile CE 7 e VxWorks MAPUS QFT MAPUS QFT System Configuration Guide Limitations In VxWorks there is a limitation to set affinity to a single core only Hence in OS_Application_Init c and OS_Create_Process c the affinity mask in the respective init_info structures should be passed accordingly SMP is not supported on the following OSs e UCOS e Nucleus e ThreadX e MQX uITRON Android T Kernel uITRON QNX Solaris NetBSD LynxOS MAPUS QFT
25. Abstraction solution for your proprietary OS platform MAPUS FT MAPUS QFT OS HOST Selection System Configuration Guide The flag has to be false for standalone generation Table 2_2 Select the host operating system Flag and Purpose Available Options OS_HOST To select the host operating system This flag is used only in AppCOE environment It is not used in the target environment In Standalone products this flag should be set to OS FALSE Target 64 bit CPU Selection Based on the OS you want the application to be built set the following pre processor definition in your project setting or make files Table 2_3 Select the Target CPU type Flag and Purpose Available Options OS_CPU_64BIT type To select the target CPU The value of OS CPU 64BIT can be any ONE of the following e OS TRUE Target CPU is 64 bit type CPU e OS FALSE Target CPU is 32 bit type CPU NOTE This value cannot be set in the cross_os_usr h instead it needs to be passed to compiler as D macro either in command line for the compiler or set this pre processor flag via the project settings If this macro is not used then the default value used will be OS_FALSE Select the OS Changer components for your application use as follows Table 2_4 OS Changer components for your application Compilation Flag Meaning MAP OS ANSI FMT IO Maps ANSI Formatted I O
26. Abstractor automatically checks the shared memory region for zombie control blocks If it finds any it will take the following action Free and initialize all the control blocks that belong to the zombie process this could even be the zombie process of the same application currently being loaded but was previously terminated abnormally Task s Stack Size The stack size has to be greater than PTHREAD_STACK_MIN defined by Linux otherwise any OS Abstractor or OS Changer task creation will return success but the actual task pthread will never get launched by the target OS It is also safe to use a value greater than or equal to OS MIN STACK SIZE defined in cross os def h OS Abstractor ensures that OS_STACK_SIZE_MIN is always greater that the minimum stack size requirement set by the underlying target OS MAPUS QFT MAPUS FT System Configuration Guide Windows Target OS Relinquish Task API uses Window s sleep to relinquish task control However the sleep function does not relinquish control when stepping through code in the debugger but behaves correctly when executed This is a problem inherent in the OS itself If you have windows interface turned ON i e OS_INCLUDE_WINDOWS OS_TRUE along with other interface libraries in your project make sure the project is build with process mode flag is turned ON i e INCLUDE_OS_PROCESS OS_TRUE If you build one interface library with process mode flag turned OFF and other
27. Get Semaphore Count OS VXWORKS 6X and OS KERNEL MODE OS FALSE MAPUS FT MAPUS FT Application Initialization Once you have configured the OS Abstractor refer to chapter OS Abstractor Configuration now you are ready to create a sample demo application System Configuration Guide Application needs to initialize the OS Abstractor library by calling the OS Application Init function prior to using any of the OS Abstractor function calls Please refer to subsequent pages for more info on the usage and definition of OS Application Init function The next step would be is to create the first task and then within the new task context application needs to call other initializations functions if required For example to use the POSIX Interface component application need to call OS Posix Init function within an OS Abstractor task context prior to using the POSIX APIs The OS Posix Init function initializes the POSIX library and makes a function call to px main function pointer that is passed along within OS Posix Init call Please note that the px main function is similar to the main function that is typically found in posix code Please refer to the example initialization code shown at the end of this section If the application also uses OS Changer components then the appropriate OS Changer library initialization calls need to be made in addition to POSIX initialization Please refer to the appropr
28. MAPUS QFT System Configuration Guide Release 1 3 9 Copyright c 2014 MapuSoft Technologies 1301 Azalea Road Mobile AL 36693 www mapusoft com MAPUS QFT System Configuration Guide Table of Contents Chapter 1 About this Guide Objectives Audience Document Conventions MapuSoft Technologies and Related Documentation Requesting Support Registering a New Account Submitting a Ticket Live Support Offline Documentation Feedback Chapter 2 System Configuration System Configuration Target OS Selection OS HOST Selection Target 64 bit CPU Selection User Configuration File Location OS Changer Components Selection POSIX OS Abstractor Selection OS Abstractor Process Feature Selection OS Abstractor Task Pooling Feature Selection OS Abstractor Profiler Feature Selection OS Abstractor Output Device Selection OS Abstractor Debug and Error Checking OS Abstractor ANSI API Mapping OS Abstractor External Memory Allocation OS Abstractor Resource Configuration OS Abstractor Minimum Memory Pool Block Configuration OS Abstractor Application Shared Memory Configuration OS Abstractor Clock Tick Configuration OS Abstractor Device I O Configuration SMP Flags OS Abstractor Target OS Specific Notes Nucleus PLUS Target ThreadX Target Precise MQX Target Linux Target User Vs ROOT Login System Resource Configuration Time Resolution Memory Heap Priority Mapping Scheme MAPUS QFT MAPUS QFT Memory and System Resource Cleanup S
29. OWS mapusoft cross os windows include Any windows platform including Windows CE platform If you use OS Abstractor Interfaceunder both Windows and Windows CE then you would require additional target license NOTE Windows 2000 Windows XP Windows CE Windows Vista from Microsoft OS_ECOS mapusoft cross os _ecos include OS_LYNXOS mapusoft cross os lynxos include OS_QNX mapusoft cross os _gqnx include OS_TKERNEL mapusoft cross os _tkernel include OS_ANDROID mapusoft cross os android include OS_NETBSD mapusoft cross os _netbsd include OS uCOoS mapusoft cross os pCOS include If you have installed the MapuSoft s products in directory location other than mapusoft then refer the corresponding directory instead of mapusoft for correct directory location MAPUS QFT MAPUS FT OS Changer Components Selection System Configuration Guide OS Abstractor optional comes with various OS Changer API solutions in addition to its BASE and POSIX API offerings OS Changer APIs are used to port legacy code base from one OS to another Select one or more OS Changer components depending on the type of code that you needed to port to one or more new operating system platforms Set the pre processor flag below to select the components needed by your application Table 2 7 OS Changer Components Selection Flag and Purpose Available Options INCLUDE OS VXWORKS
30. RUE OS Abstractor automatically replaces open calls to OS open during compile time when you include os_target h in your source code If you set MAP_OS_ANSI_IO to OS_FALSE then in your source code when you include os_target h application can actually use both OS_open and open calls where the OS open will come from OS Abstractor library and open will come from the native OS library Given that OS Abstractor I O APIs are similar to ANSI I O you probably can use the third option so that you eliminate some performance overhead going through OS Abstractor I O wrappers if necessary But it is always recommended that application use OS Abstractor or POSIX APIs instead of directly using native API calls from OS libraries for maximum portability MAPUS QFT MAPUS QFT OS Abstractor External Memory Allocation System Configuration Guide OS Abstractor APIs can be mapped to exact ANSI names by turning on these features Table 2_15 OS Abstractor External Memory Allocation Flag and Purpose Available options OS_USE_EXTERNAL_MALL OS_TRUE OS Abstractor can be configured to oc use an application defined external functions to allocate and free memory needed dynamically by the process In this case the OS Abstractor will use these function for allocating and freeing memory within OS Allocate Memory and OS Deallocate Memory functions These external functions needs to be similar to malloc and free and should be defined within cr
31. TE The actual virtual address of the shared memory may be different across processes application however the OS Abstractor initialized the System Config pointer correctly during OS_Application_Init function call Applications should not pass the shared memory region address pointer from one process to another since the virtual address pointing to the shared region may differ from process to process instead use the above global variable defined above for shared memory region access from each process applications MAPUS QFT MAPUS QFT OS Abstractor Clock Tick Configuration Table 2_20 OS Abstractor Clock Tick Configuration System Configuration Guide Flag and Purpose Default Setting OS_TIME_RESOLUTION 10000 u second 10milli sec This will be the system clock ticks Normally this value is derived from the not hardware clock tick target OS If you cannot derive the value then refer to the target OS For example when you call reference manual and set the correct OS_Task_Sleep 5 you are per clock tick value suspending task for a period 5 OS TIME RESOLUTION See NOTES in this table OS DEFAULT TSLICE 10 Number of system ticks If system tick Default time slice scheduling window is 10ms then the threads will be width among same priority pre schedule round robin at the rate of emptable threads when they are all every 100ms in ready state NOTE On Linux operating system the time slice cannot be modified
32. able Options INCLUDE_OS_PROCESS OS TRUE Include OS Abstractor process support APIs and track resources under each process and also allow multiple individually executable applications to use OS Abstractor OS FALSE Do not include process model support Use this option for optimized OS Abstractor performance The default is OS_FALSE The INCLUDE_OS_PROCESS option is useful when there are multiple developers writing components of the applications that are modular The resource created by the process is automatically tracked and when the process goes away they also go away One process can use another process resource only if that process is created with system scope A process cannot delete a resource that it did not create The INCLUDE_OS_PROCESS feature can also be used on target OS like VxWorks 5 x a non process based operating system In this case the OS Abstractor provides software process protection Under process based OS like Linux the processes created by the OS Abstractor will be an actual native system processes The INCLUDE_OS_PROCESS feature is also useful to simulate complex multiple embedded controller application on x86 single processor host platform In this case each individual process application will represent individual controllers which uses a shared memory region for inter communication This application could then be ported to the real multiple embedded controller environments with shared physica
33. alid response Live Support Offline MapuSoft Technologies also provides technical support through Live Support offline To contact live support offline 1 From http www mapusoft com main page select Support gt Live Support Offline 2 Enter your personal details in the required fields Enter a message about your technical query One of our support personnel will get back to you as soon as possible 3 Click Send You can reach us at our toll free number 1 877 627 8763 for any urgent assistance Documentation Feedback Send Feedback on Documentation http www mapusoft com support index php MAPUS QFT MAPUS QFT System Configuration Guide Chapter 2 System Configuration This chapter contains the information about the System Configuration with the following topics System Configuration Target OS Selection OS HOST Selection Target 64 bit CPU Selection User Configuration File Location OS Changer Components Selection POSIX Interface Selection OS Abstractor Interface Process Feature Selection OS Abstractor Interface Task Pooling Feature Selection OS Abstractor Interface Profiler Feature Selection OS Abstractor Interface Output Device Selection OS Abstractor Interface Debug and Error Checking OS Abstractor Interface ANSI API Mapping OS Abstractor Interface Resource Configuration OS Abstractor Interface Minimum Memory Pool Block Configuration OS Abstractor Interface Application Shared Memory Configu
34. ation code Runtime Memory Allocations OS Abstractor Interface Some of the allocations for this product will be dependent on the native OS Some of these may be generic among all products The thread stacks should come from the process heap This is only being done on the OS Abstractor for QNX product at the moment Message in int_os_send_to_pipe Device name in os_creat Partitions in os_create_partition_pool Device name in os_device_add File structures in os_init_io Driver structures in os_init_io Device header for null device in os_init_io Device name for the null device in os_init_io Device name in os_open Environment structure in os_put_environment Environment variable in os_put_environment Memory for profiler messages if profiler feature is turned ON Thread stack only under QNX MAPUS QFT MAPUS QFT System Configuration Guide POSIX Interface All of the following allocations use OS_Allocate_Memory using the System_Memory pool Thus all these allocations come from the calling processes memory pool e Pthread key lists and values e Stack item in pthread_cleanup_push e Sem_t structures created by sem_open Timer_t structures created by timer_create mqueue_t structures created by mq_open Message in mq_receive This is deallocated before leaving the function call Message in mq_send This is deallocated before leaving the function call e Message in mq_timedreceive This is deallocated before leaving the func
35. be OS SYSTEM OVERHEAD memory pool size System Memory This will be set to 0 Since there are no processes the first pool will always be the system memory pool Native Heap Size System ocnfig structure Reserved for OS Abstractor use system memory MAPUS FT MAPUS FT System Configuration Guide Native process heap size We are not adjusting the native process heap size so it could be possible that there is an inconsistency between the amount of memory reserved by OS Abstractor and the amount of memory reserved for the actual heap of the native process There is no upper bounds limit to the system wide memory use while in process mode We will create processes without regard to the actual size of the physical memory Memory Usage under Single memory model based OS Multi process Application System_Config The first available memory will be set in the OS_APP_INFO structure and will be adjusted the size of the system_config structure OS_Application_Init The memory value passed into this API by memory_pool_size will be the heap size for this particular process This API can only be called once since it is not possible to have multiple applications natively This API will create an OS Abstractor dynamic memory pool the size of the heap OS_Create_Process The memory value passed into this API by process_heap_size will be the heap size for this particular process This API will create an OS Abstractor dynamic memory pool the siz
36. beyond the pool size The maximum memory the application can get from these pools will depend on the memory availability of the system heap Priority Mapping Scheme The OS Abstractor uses priorities 0 255 plus one more for exclusivity which results in a total of 257 priorities If the Linux that you use provides less than 257 priority values then OS Abstractor maps its priority in a simple window mapping scheme where a window of OS Abstractor priorities gets mapped to each individual Linux priority If the Linux that you use provides more than 257 priority values then the OS Abstractor maps it priority one on one somewhere in the middle of the range of Linux priorities Please modify the priority scheme as necessary if required by your application If you want to minimize the interruption of the external native Linux applications then you would want the OS Abstractor priorities to map to the higher end of the Linux priority window OS Abstractor priority value of 257 is reserved internally by OS Abstractor to provide the necessary exclusivity among the OS Abstractor tasks when they request no preemption or task protection The exclusivity and protections are not guaranteed if the external native Linux application runs at a higher priority It is recommended that the Linux kernel be configured to have a priority of 512 so that the OS Abstractor priorities will use the window range in the middle and as such would not interfere with some of core Linu
37. bsequent multi process application gets loaded they will register and OS Abstractor will create all the local resources memory heap necessary for the application Application s can also spawn new applications using OS_Create_Process and will result the same as if a new application get s loaded Each application needs to call OS_Application_Free to unregister and free OS Abstractor resources used by the application Under circumstances where the application terminates abnormally the applications need to install appropriate signal handler and call OS Application Free within them When the last application calls OS_Application_Free then OS Abstractor frees the resources used by the application and also deletes the shared memory region Manual Clean up If application terminates abnormally and for any reason and it was not possible to call OS Application Free then it is recommended that you execute the provide cleanup pl script manually before starting to load applications Users can query the interprocess shared resources status by typing ipcs in the command line Multi process Zombie Cleanup There are circumstances where a multi process application terminates abnormally and was not able to call OS_Application_Free In this case the shared memory region would be left with a zombie control block i e there is no native process associated with the OS Abstractor process control block Whenever a new multi process application get s loaded OS
38. d Memory Configuration Table 2_20 OS Abstractor Clock Tick Configuration Table 2_21 OS Abstractor Device I O Configuration Table 2_23 Compilation Flag for SMP Table 2_21 Compilation Flag For Nucleus PLUS Target Table 2_22 Compilation Flag for Precise MQX Target Table 2_24 Version Flags for VxWorks Target Table 2_25 Unsupported OS Abstractor APIs for VxWorks Target Table 2_26 Simple single process Versus Complex multiple process Applications Table 3_1 Symbols and Breakpoints Fields related about Ada task MAPUS QFT MAPUS QFT System Configuration Guide Chapter 1 About this Guide This chapter contains the following topics Objectives Audience Document Conventions MapuSoft Technologies and Related Documentation Requesting Support Documentation Feedback MAPUS QFT MAPUS QFT Objectives System Configuration Guide This manual contains instructions on how to get started with the Mapusoft products The intention of the document is to guide the user to install configure build and execute the applications using Mapusoft products Audience This manual is designed for anyone who wants to port applications to different operating systems create projects and run applications This manual is intended for the following audiences e Customers with technical knowledge and experience with the Embedded Systems e Application developers who want to migrate their application to different RTOSs e Managers wh
39. d to be used again by the task pool For further details please refer to the OS Create Task specification defined in the following pages An Application can add or remove tasks with a specified stack size to the task pool at any time The task pool will grow or shrink depending on each addition or deletion of tasks in the task pool The Application cannot remove a valid task which does not belong to the task pool OS Get System Info function can be used to retrieve the system configuration and run time system status including information related to task pool If OS TASK POOLING is enabled then all tasks POSIX threads created using the POSIX Interface POSIX APIs provided by POSIX Interface with POSIX and or any task creation created using task create functions in any Interface products will automatically use the task pool mechanism with the flag option set to OS POOLED TASK NOWAIT Warning Your application will fail during task creation if OS_TASK POOLING is enabled and you have not added any tasks to the task pool Make sure you add tasks via OS Add To Task Pool function with all required stack sizes prior to creating pooled tasks via OS_Create_Task function Special Notes Task Pooling feature is not supported in ThreadX uCOS and Nucleus targets MAPUS QFT MAPUS QFT OS Abstractor Profiler Feature Selection System Configuration Guide The following are the user configuration options that can be set in the cross os u
40. de the task scheduling is fully under the mercy of the Linux scheduler In this mode the OS Abstractor does not utilize any real time priorities and or policies It will use the SCHED_OTHER policy and will ignore the application request to set and or change scheduler parameters like priority and such OS Abstractor applications will run under the non ROOT mode with restrictions to the following OS Abstractor APIs e OS Create Task The function parameters priority time slice and OS NO PREEMPT flag options are ignored e OS Set Task Priority This function will have no effect and will be ignored e OS Set Task Preemption Changing the task pre emption to OS NO PREEMPT has no effect and will be ignored e OS Protect Will offer NO critical region data protection and will be ignored If you need protection then utilize OS Abstractor mutex features e OS Create Driver The OS Abstractor driver task will NOT be run at a higher priority level that the OS Abstractor application tasks Though OS Abstractor applications may run under non ROOT user mode it is highly recommended that the real target applications be run under ROOT user mode System Resource Configuration Linux has a limit on the sysv system resources Typically OS Abstractoris able to adjust these limits as required But if the CAP SYS RESOURCE capability is disabled OS Abstractorwill not have the proper access privileges to do so In this case the values will need to be adjusted
41. define define define define endif HOST ROOT PROCESS STACK SIZE HOST ROOT PROCESS HEAP SIZE HOST DEFAULT TIMESLICE HOST MAX TASKS HOST MAX TIMERS HOST MAX MUTEXES HOST MAX PIPES HOST MAX PROCESSES HOST MAX QUEUES HOST MAX PARTITION MEM POOLS HOST MAX DYNAMIC MEM POOLS HOST MAX EVENT GROUPS HOST MAX SEMAPHORES HOST MAX PROTECTION STRUCTS HOST USER SHARED REGION1 SIZ HOST ROOT PROCESS AFFINITY set the OS APP INIT INFO s we will use If we set all the Variables to 1 System Configuration Guide NUNA OORO E tructure with the actual number of resources the default values would be used On ThreadX and Nucleus we must pass an OS_APP_INIT_INFO structure with at least first_available set to t NULL to OS_Application Init and a VOID OS Main STATUS sts OS_APP_INIT_INFO info UNSIGNED process id Os Os OS_HOST OS_TRUE Initialize the info structure create a custom cross_os_usr at that time so this structur info debug info info task_pool_timeslice info task pool timeout info root process preempt info root process priority info root process stack size info root process heap size info default timeslice info max tasks info max timers info max mutexes info max pipes info max processes info max queues info max partition mem pools info max dynamic mem pools info max event groups info max semaphores info max protection structs info user shared regionl size M
42. e Reserved 2 constant Interrupt_ID 2 SOVFI constant Interrupt ID 3 Status stack or loop stack overflow of PC stack full SFT2I constant Interrup 30 User software interrupt 2 SFT3I constant Interrupt_ 31 User software interrupt 3 Useful constants First Interrupt constant Interrupt_ID 0 Last_Interrupt constant Interrupt_ID 31 end Ada Interrupts Names These interrupt names can be used in a pragma Attach Handler or in the operations defined in Ada Interrupts For example to attach a handler permanently protected PO is procedure Handler pragma Attach Handler Handler Ada Interrupts Names IRQOI end PO Or in a more dynamic situation protected PO is procedure Handler pragma Interrupt Handler Handler end PO And then from time to time Ada Interrupts Attach Handler New Handler gt PO Handler Access MAPUS QFT MAPUS QFT Interrupt gt Ada Interrupts Names IRQOI System Configuration Guide The interrupts marked above as reserved are reserved for the Ada run time system or the real time kernel The Reserved_n interrupts are reserved by the hardware You cannot attach handlers to reserved interrupts If you try Program_Error will be raised Exceptions in Interrupt Handlers If an exception is propagated out of an interrupt handler it is ignored So if you have a bug that causes an unhandled exception the exception is lo
43. e single process application or complex multi process application Complex and large applications will greatly benefit in using the OS_INCLUDE_PROCESS feature support offered by OS Abstractor Table 2_26 Simple single process Versus Complex multiple process Applications OS_INCLUDE_PROCESS OS_FALSE Simple OR Single process Application OS_INCLUDE_PROCESS OS_TRUE Complex OR multi process Application OS Abstractor applications are independent from each other and are complied and linked into a separate executables There is no need for the OS Abstractor and or OS Changer APIs to work across processes OS Abstractor applications can share the OS Abstractor resources as long as they are created with system scope between them even though they may be complied and linked separately The OS Abstractor and or OS Changer APIs works across processes Many independent or even clones of OS Abstractor single process applications can be hosted on the OS platform In addition to independent single process applications the current release of OS Abstractor allows to host one multi process application OS Abstractor applications do NOT spawn new processes via the OS_Create_Process function In fact any APIs with the name process in them are not available for a _ single process application OS Abstractor applications can spawn new processes via the OS_Create_Process function Each application us
44. e from the process specific dedicated memory pool since the control blocks are required to be shared across multiple applications OS Abstractor Minimum Memory Pool Block Configuration Table 2 18 OS Abstractor Minimum Memory Pool Block Configuration Flag and Purpose Default Setting OS MIN MEM FROM POOL 4 bytes Minimum memory allocated by the malloc and or NOTE Increasing this value further OS Allocate Memory calls This will reduces memory fragmentation at the be the memory allocated even when cost of more wasted memory application requests a smaller memory size OS Abstractor Application Shared Memory Configuration Table 2_19 OS Abstractor Application Shared Memory Configuration Flag and Purpose Default Setting OS_USER_SHARED_REGION1 SIZE 1024 bytes Application defined shared memory region usable across all process based OS Abstractor processes applications Process based applications are required to be built with OS INCLUDE PROCESS feature set to OS TRUE OS Abstractor includes this shared user region in the memory area immediately following all the OS Abstractor control block allocations Applications can access the shared memory via the System Config gt user shared regionl global variable Also access to shared MAPUS FT MAPUS FT System Configuration Guide memory region must be protected i e use mutex locks prior to read write by the application NO
45. e of the heap System_Memory This will always be set to 0 When we get a pool id of O in any of the allocation APIs we will know to allocate from the current process memory pool This means that the dynamic memory pool control block at index 0 is not to be used System Config structure Raw memory starting at first available Process memory heap for Process 0 Process memory heap for Process 1 MAPUS QFT MAPUS FT Single process Application System Configuration Guide System Config The first available memory will be set in the OS APP INFO structure and will be adjusted the size of the system config structure OS Application Init the memory value passed into this API by memory pool size will be the amount of memory available to the system This API will create an OS Abstractor dynamic memory pool this size The memory for System Config does not come from this pool So the total memory requirements will be OS SYSTEM OVERHEAD memory pool size System Memory This will always be set to 0 Since we are not in process mode there should not be any other OS Abstractor memory pools created System config Structure Raw memory starting at first available System Memory There is no upper bounds limit to the system wide memory use while in process mode Also it cannot be guaranteed that there will be enough memory to create all the processes of the application since there is no total memory being reserved MAPUS FT
46. ed when the primary stack overflows Other storage overflows go through rts_raise directly and bypass rts_raise_storage_error To stop when an exception is re raised e g via the raise statement in Ada set a break point at rts_raise_occurrence When rts_raise is called the only parameter is the address of a string containing the full name of the exception being raised When rts_raise_occurrence is called the only parameter is the address of an exception_occurrence record which contains as its first word a pointer to the string name of the exception being re raised Generics and Inlines It is not generally possible to set a breakpoint in an instance of a generic or an inline expansion of a subprogram call However line number information is included which should allow the C debugger to step through instances and inlines Tasking related Symbols and Breakpoints To determine the current task the global variable per_thread_ptr points to the task control block for the current task The global variable main_thread is the task control block for the environment main thread of the program More information on the Ada task is described in the following fields Table 3_1 Symbols and Breakpoints Fields related about Ada task Position in Record Field Name Meaning 2 highwater_mark Secondary stack pointer Ss_last_chunk Secondary stack limit Ss_Priority Current task priority Name null terminated
47. ee or re start itself with a call to OS Application Free An application can delete or re start another application via OS_Delete_Process Also it is up to the application to provide the necessary synchronization during loading individual applications so that the complex application will start to run only in the preferred sequence Memory Usage The memory usage depends on whether your application is built in single process mode i e OS_INCLUDE_PROCESS set to false or multi processes mode i e OS_INCLUDE_PROCESS set to true The memory usage also depends on whether the target OS supports single memory model or a virtual memory model Operating systems such as LynxOS Linux Windows XP etc are based on virtual memory model where each application are protected from each other and run under their own virtual memory address space Operating systems like Nucleus PLUS ThreadX MQX etc are based on single memory model where each application shares the same address space and there is no protection from each other In general OS Abstractor applications require memory to store the system configuration and also to meet the application heap memory needs Memory Usage under Virtual memory model based OS Multi process Application System_Config The system config structure will be allocated from shared memory The size will be returned to the user for informational use via the OS_SYSTEM_OVERHEAD macro OS_Application_Init the mem
48. em All the memory requirements come from its own process dedicated memory pool called process system pool Upon deletion of the process all these resources will automatically become freed Depending on whether the resource needs to be shared across other processes they can be created with a scope of either OS_SCOPE_SYSTEM or OS_SCOPE_PROCESS The resources with system scope can be accessible or usable by the other processes However the process that creates them can only do deletion of these resources with system scope A new process will be created as a new entity and not a copy of the original As such none of the resources that are open becomes immediately available to the newly created process The new created process can use the resources which were created with system scope by first retrieving their ID through their name For this purpose the application should create the resources with unique names OS Abstractor will all resource creation with duplicate names however the function that returns the resource ID from name will provide the ID of only the first entry Direct access to any OS Abstractor resource control blocks are prohibited by the application In other words the resource Ids does not directly point to the addresses of the control blocks MAPUS QFT MAPUS QFT Simple single process Versus Complex multiple process Applications System Configuration Guide An OS Abstractor application can be simple i
49. ents identifying the original Ada source line and the target debugger will show the generated C source rather than the original Ada source when stepping through an AdaMagic program Local Ada Variable Display in a C debugger When either the ga or gc flag is given information on all Ada local variables is carried forward into the debugger symbol information included in the generated object modules Because Ada ignores upper lower case whereas a typical C debugger distinguishes between upper and lower case it is important to understand the canonical upper lower case conventions used in the generated debugger symbol information In particular the original upper lower case in the Ada name is ignored the name in the debugger symbol table always starts with an upper case letter and then the remaining letters are in lower case For example an Ada local variable called My Local Variable would appear in the debugger as My local variable Global Ada Variable Display in a C debugger For Ada variables or subprograms declared inside packages a concatenated name appears in the debugger symbol table The concatenated name consists of the package name canonicalized so that the first letter is upper case followed by an underscore _ followed by the name of the variable or subprogram inside the package again with the first letter capitalized For example an Ada variable whose full name is My_Package My_Global would appea
50. es its own user configuration parameters set in the cross os usr h file Each application has to have the same set of shared resources defined in the cross_os_usr h e g max number of tasks threads across all multi process applications When the first multi process application gets loaded the OS Abstractor uses the values defined in cross_os_usr h or the over ride values passed along its call to OS_Application_Init function to create all the shared system resources When subsequent multi process application gets loaded OS Abstractor ignores the values defined in the cross_os_usr h or the values passed in the OS_Application_Init call Please note that the shared resources are only gets created during the load time of the first application and they gets deleted when the last multi process application exits OS Abstractor creates all the resource control blocks within the process memory individually for each application OS Abstractor creates all the resource control blocks in shared memory during the first OS Application Init function call In other words when the first application gets loaded it will initialize the OS Abstractor library After this every subsequent OS Application Init call MAPUS FT MAPUS QFT System Configuration Guide will register and adds the application as a new OS Abstractor process and also creates the memory pool for the requested heap memory An application can delete or fr
51. f the OS_Target should be for the OS Abstractor To select the target Interface product that you have purchased For Example if you operating system have purchased the license for OS_NUCLEUS Nucleus PLUS from ATI OS_THREADX ThreadX from Express Logic OS_VXWORKS VxWorks from Wind River Systems OS_ECOS eCOS standards from Red Hat OS MQX Precise MQX from ARC International OS_UITRON micro ITRON standard based OS OS_LINUX Open source commercial Linux distributions OS WINDOWS Windows 2000 Windows XP Windows CE Windows Vista from Microsoft If you need to use the OS Abstractor Interface both under Windows and Windows CE platforms then you will need to purchase additional target license OS_TKERNEL Japanese T Kernel standards based OS OS_LYNXOS LynxOS from LynuxWorks OS_QNX QNX operating system from QNX OS_LYNXOS LynxOS from Lynuxworks OS_SOLARIS Solaris from SUN Microsystems OS ANDROID Mobile Operating System running on Linux Kernel OS_NETBSD UNIX like Operating System OS_uCOS uCOS from Micrium For example if you want to develop for ThreadX you will define this flag as follows OS_TARGET OS_THREADX PROPRIETARY OS If you are doing your own porting of OS Abstractor Interface to your proprietary OS you could add your own define for your OS and include the appropriate OS interface files within os_target h file MapuSoft can also add custom support and validate the OS
52. functions to the OS Abstractor equivalent MAP OS ANSL IO Maps ANSI I O functions to the OS Abstractor equivalent SSIC INCLUDE OS PSOS CLA set to OS TRUE to build for use with the OS Changer for pSOS Classic product Select the following definition if you want OS Changer to enable error checking for debugging purposes Table 2 5 Set the Pre processor Definition For error checking Compilation Flag Meaning OS DEBUG INFO Enable error checking for debugging MAPUS FT MAPUS QFT User Configuration File Location System Configuration Guide The default directory location of the cross_os_usr h configuration file is given below Table 2_6 Cross_os_usr h Configuration File Target OS Configuration Files Directory Location OS_NUCLEUS mapusoft cros_os_nucleus include OS_THREADX mapusoft cross os _threadx include OS_VXWORKS mapusoft cross os vxworks include Please make sure you specify the appropriate target OS versions that you use in the osabstractor_usr h OS_MQX mapusoft cross os _mqx include OS_UITRON mapusoft cross os _uitron include OS_LINUX mapusoft cross os linux include Please make sure you specify the appropriate target OS versions that you use in the cross_os_usr h NOTE RT Linux for using RT Linux you need to select this option OS_SOLARIS mapusoft cross os _solaris include OS_WIND
53. iate Interface reference manual for more details Please refer to the init c module provided with the sample demo application for the specific OS tools and target for OS Abstractor initialization and on starting the application If you need to re configure your board differently or would like to use a custom board or would like to re configure the OS directly then refer to the appropriate documentations provided by the OS vendor Example OS Abstractor for Windows Initialization int main int argc LPSTR argv OS Main return OS SUCCESS main if OS_HOST OS_TRUE The below defines are the system settings used by the OS Application_Init function Use these to modify the settings when running on the host A value of 1 for any of these will use the default values located in cross os usr h When you optimize for the target side code the wizard will create a custom cross os usr h using the settings you specify at that time so these defines will no longer be necessary define HOST TASK POOLING OS FALSE to use task pooling set this to OS TRUE and make sure add tasks to pool using OS Add To Pool apis define HOST DEBUG INFO define HOST TASK POOL TIMESLICE define HOST TASK POOL TIMEOUT define HOST ROOT PROCESS PREEMPT define HOST ROOT PROCESS PRIORITY MAPUS FT MAPUS FT define define define define define define define define define define define define
54. ies and policies Under non ROOT user mode the task scheduling is fully under the mercy of the Linux scheduler In this mode the OS Abstractor does not utilize any real time priorities and or policies It will use the SCHED_OTHER policy and will ignore the application request to set and or change scheduler parameters like priority and such OS Abstractor applications will run under the non ROOT mode with restrictions to the following OS Abstractor APIs OS_Create_Task The function parameters priority time slice and OS_NO_PREEMPT flag options are ignored e OS Set Task Priority This function will have no effect and will be ignored e OS_Set_Task_Preemption Changing the task pre emption to OS_NO_PREEMPT has no effect and will be ignored e OS_Protect Will offer NO critical region data protection and will be ignored If you need protection then utilize OS Abstractor mutex features e OS Create Driver The OS Abstractor driver task will NOT be run at a higher priority level that the OS Abstractor application tasks MAPUS QFT MAPUS QFT System Configuration Guide Though OS Abstractor applications may run under non ROOT user mode it is highly recommended that the real target applications be run under ROOT user mode Time Resolution The value of the system clock ticks is defined by OS TIME RESOLUTION which is retrieved from the Linux system Under Red Hat GNU Linux this is actually 100 this means every tick equals
55. ing defines PROFILER_TASK_PRIORITY The priority level O to 255 of the profiler thread The profiler thread starts picking up the messages in the profiler queue formats them into XML record and write to file If the priority is set to the lowest i e 255 then the profiler thread may not have an opportunity to pick the message from the queue in time and as such the queue gets filled up and as such the profiler will stop The default profiler task priority value is set to 200 NUM OF MSG TO HOLD IN MEMORY This will be the depth of the profiler queue The bigger the number the more the memory is needed A maximum of 30 000 profiler records can be created Please make sure you increase you application s heap size by NUM OF MSG TO HOLD IN MEMORY times PROFILER MSG SIZE in the OS Application Init call PROFILER DATAFILE PATH This will be the directory location where the profiler file will be created For Linux The default location set is root OS FALSE Profiler code will be excluded and the feature will be turned off The default value is OS_FALSE MAPUS QFT MAPUS QFT System Configuration Guide The profiler starts as soon as the application starts and will continue to collect performance data until the memory buffers in the profiler queue gets filled up After this the profiling stops and data is dumped into pal files at the user specified location It is recommended that the profiler featu
56. ingle process Application Exit Multi process Application Exit Manual Clean up Multi process Zombie Cleanup Task s Stack Size Windows Target Android Target Installing and Building the Android Platform Adding Mapusoft Products to the Android Platform Running the Demos from the Android Emulator QNX Target User Vs ROOT Login Time Resolution Memory Heap Priority Mapping Scheme Memory and System Resource Cleanup Task s Stack Size Dead Synchronization Object Monitor VxWorks Target Version Flags Unsupported OS Abstractor APIs Application Initialization Example OS Abstractor for Windows Initialization Example POSIX Interface for Windows Target Initialization Runtime Memory Allocations OS Abstractor Interface POSIX Interface micro ITRON Interface VxWorks Interface pSOS Interface Nucleus Interface System Configuration Guide Memory Usage Memory Usage under Virtual memory model based OS Multi process Application Single process Application Memory Usage under Single memory model based OS Multi process Application Single process Application Chapter 3 Ada System Configuration 57 Data Layout Interface to C Machine Code Inserts Implementation Defined Conventions Interrupt Handling Exceptions in Interrupt Handlers MAPUS QFT MAPUS QFT Implementation Defined Pragmas Debugging Ada Programs Source File Display in a C debugger Local Ada Variable Display in a C debugger Global Ada
57. interface libraries with process mode flag ON then segmentation fault will occur due to mismatch all libraries not being built with the current process feature Android Target Installing and Building the Android Platform Prerequisites To install and build Android requires the following packages e JDK 5 0 update 12 or higher Java 6 will not work Download from http java sun com Android 1 5 SDK Download from http developer android com sdk 1 5 _r3 index html Android 1 5 NDK Download from http developer android com sdk ndk 1 5_r1 index html Refer to the Android website for instructions on how to properly install and configure the SDK and the NDK It is very important that JDK 6 is not used JDK 6 will cause compiler errors If you have both JDK s installed confirm that JDK 5 0 is the one that will be used by using the command which java Adding Mapusoft Products to the Android Platform To add Mapusoft products to Android Platform Add the Mapusoft project into the android ndk 1 5_r1 sources directory This directory is referred to as lt MAPUSOFT_ROOT gt Run the setup sh script located in lt MAPUSOFT_ROOT gt cross_os_android This creates symbolic links for the demo applications The command used to build the applications is make APP lt app_ name gt For instance to build the OS Abstractor demo the command would be make APP demo cross os MAPUS QFT MAPUS QFT Running the Demos fro
58. l memory Process Feature use within OS Changer It is possible for legacy applications to use the process feature along with OS Changer and take advantage of process protection mechanism and also have the ability to break down the complex application into multiple manageable modules to reduce complexity in code development However when porting legacy code we recommend that the application be first ported to a single process successfully Once this is completed then the application can be modified to move the global data to shared memory and can be made to easily reside into individual process and or multiple executables To allow the legacy applications to be broken down into process modules and or multiple applications the flag INCLUDE_OS_ PROCESS needs to be set to OS_TRUE Also the application needs to use OS_Create_Process envelopes to move the resources to appropriate processes Legacy application can also make in multiple applications which then compile separately and can continue to use Interface APIs for inter process communication Interface APIs provides transparency to the application and allows the application to use the API among resources within a single process or multiple processes applications MAPUS QFT MAPUS QFT OS Abstractor Task Pooling Feature Selection System Configuration Guide Task Pooling feature enhances the performances and reliability of application Creating a task thread at run time require conside
59. m the Android Emulator System Configuration Guide To run the demos from Android Emulator Follow the steps documented on the Android developer site on how to create an AVD for the emulator Launch the emulator with the command emulator avd lt avd_name gt Open another terminal and enter the command adb logceat This will capture the log output from the emulator After the emulator launches click on the menu button to unlock the phone Click on the popup arrow on the screen The demos should be listed in the list of applications Click on one to launch it The demo output will be piped into the adb terminal window QNX Target User Vs ROOT Login OS Abstractor internally checks the user ID to see if the user is ROOT or not If the user is ROOT then it will automatically utilize the Linux real time policies and priorities It is always recommended that OS Abstractor application be run under ROOT user login In this mode e OS Abstractor task priorities time slice pre emption modes and critical region protection features will work properly e OS Abstractor applications will have better performance and be more deterministic behavior since the Linux scheduler is prevented to alter the tasks priorities behind the scenes e Also when you load other Linux applications that uses the default SCHED_OTHER policies they will not impact the performance of the OS Abstractor applications that are running under real time priorit
60. o want to minimize the cost and leverage on their existing code Document Conventions Table 1_1 defines the notice icons used in this manual Table 1_1 Notice Icons Ico Meaning Description n ee Informational note Indicates important features or icons A Caution Indicates a situation that might result in loss of data or software damage Table 1_2 defines the text and syntax conventions used in this manual Table 1_2 Text and Syntax Conventions Convention Description Courier New Identifies Program listings and Program examples Italic text like this Introduces important new terms e Identifies book names e Identifies Internet draft titles COURIER NEW ALL CAPS Identifies File names Courier New Bold Identifies Interactive Command lines MAPUS QFT MAPUS QFT MapuSoft Technologies and Related Documentation System Configuration Guide Reference manuals can be provided under NDA Click http mapusoft com contact to request for a reference manual The document description table lists MapuSoft Technologies manuals Table 1_3 Document Description Table User Guides Description AppCOE Quick Start Guide Provides detailed description on how to become familiar with AppCOE product and use it with ease This guide e Explains how to quickly set up AppCOE on Windows Linux Host and run the demos that came along AppCOE Common Envi
61. ority Last Default Priority constant Priority Priority First Priority Last 2 MAPUS QFT MAPUS QFT System Configuration Guide Interrupts are masked when an interrupt hander is executing and when a task is executing at a priority in Interrupt_Priority because it called a protected operation of an interrupt level protected object Example 1 We show three examples of interrupt handling below The first example shows how to attach a simple interrupt handler The second example shows how to communicate information from the interrupt handler to Ada tasks using protected entries The third example shows how to use suspension objects see RM D 10 to notify a task from an interrupt handler that the event has occurred The first example prints the following Hello from Simple_Interrupt_Test main procedure O interrupts so far 1 interrupts so far 2 interrupts so far 9 interrupts so far 10 interrupts This is a simple example of interrupt handling using protected procedures as interrupt handlers We attach an interrupt handler that just counts up the number of times it is called We then simulate some interrupts and print out the count with Ada Interrupts Names use Ada Interrupts Names This is where the names of all the hardware interrupts are declared with Ada_Magic DBG use Ada_Magic DBG We could use Text_IO instead but Ada_Magic DBG is much smaller so it s bette
62. ory value passed into this API by memory_pool_size will be the heap size for this particular process In this type of system it is possible to have multiple applications all of which will call this API This API will create an OS Abstractor dynamic memory pool the size of the heap The global variable System_Memory will be set to the id of this pool OS_Create_Process The memory value passed into this API by process_heap_size will be the heap size for this particular process This API will create an OS Abstractor dynamic memory pool the size of the heap The global variable System_Memory will be set to the id of this pool System_Memory This will be set to the pool id of the process memory pool MAPUS QFT MAPUS FT Application 1 Application 2 System Configuration Guide Native Heap Size Native Heap Size Reserved for OS_Abstractor use Shared memory Reserved for OS_Abstractor use Shared memory System config located in Single process Application System Config The system config structure will be allocated from the process heap The size will be returned to the user for informational use only by calling OS System Overhead OS Application Init the memory value passed into this API by memory pool size will be the amount of memory available to the system This API will create an OS Abstractor dynamic memory pool this size The memory for System Config does not come from this pool So the total memory requirements will
63. oss_os_usr h in order for OS Abstractor to successfully use them This feature is useful if the application has its own memory management schemes far better than what the OS has to offer for dynamic allocations OS FALSE OS Abstractor will directly use the target OS system calls for allocating and freeing the memory The default value is OS_FALSE OS Abstractor Resource Configuration In addition to OS Abstractor resources used by application there may be some additional resources required internally by OS Abstractor The configuration should take into the account of these additional resources while configuring the system requirements All or any of the configuration parameters set in cross_os_usr h configuration file can be altered by OS_Application_Init function The following are the OS Abstractor system resource configuration parameters Table 2_16 OS Abstractor system resource configuration parameters Flag and Purpose Default Setting OS_TOTAL_SYSTEM_PROCESSES 100 The total number of processes required by the application One control block will be used by the OS_Application_Init function when the INCLUDE_OS_PROCESS option is true OS_TOTAL_SYSTEM_TASKS 100 The total number of tasks required by the application One control block will be used by the OS_Application_Init function when the INCLUDE_OS_PROCESS option is true OS_TOTAL_SYSTEM_PIPES 100 The total number of pipes for message passing required by the a
64. phic images and software owned by MapuSoft and hereby authorizes you to electronically copy documents published herein solely for the purpose of reviewing the information You may not alter any files in this document for advertisement or print the information contained herein without prior written permission from MapuSoft MapuSoft assumes no responsibility for errors or omissions in this publication or other documents which are referenced by or linked to this publication This publication could include technical or other inaccuracies and not all products or services referenced herein are available in all areas MapuSoft assumes no responsibility to you or any third party for the consequences of an error or omissions The information on this web site is periodically updated and may change without notice This product includes the software with the following trademarks MS DOS is a trademark of Microsoft Corporation UNIX is a trademark of X Open IBM PC is a trademark of International Business Machines Inc Nucleus PLUS and Nucleus NET are registered trademarks of Mentor Graphics Corporation Linux is a registered trademark of Linus Torvald VxWorks and pSOS are registered trademarks of Wind River Systems MAPUS QFT
65. plication Start UNSIGN User application code MAPUS FT MAPUS FT Example POSIX Interface for Windows Target Initialization System Configuration Guide int main int argc LPSTR argv OS Main return OS SUCCESS main if OS_HOST OS_TRUE The below defines are the system settings used by the OS Application_Init function Use these to modify the settings when running on the host A value of 1 for any of these will use the default values located in cross os usr h When you optimize for the target side code the wizard will create a custom cross os usr h using the settings you specify at that time so these defines will no longer be necessary define HOST TASK POOLING OS FALSE to use task pooling set this to OS TRUE and make sure add tasks to pool using OS Add To Pool apis define HOST DEBUG INFO define HOST TASK POOL TIMESLICE define HOST TASK POOL TIMEOUT define HOST ROOT PROCESS PREEMPT define HOST ROOT PROCESS PRIORITY define HOST ROOT PROCESS STACK SIZE define HOST ROOT PROCESS HEAP SIZE define HOST DEFAULT TIMESLICE define HOST MAX TASKS define HOST MAX TIMERS define HOST MAX MUTEXES define HOST MAX PIPES define HOST MAX PROCESSES define HOST MAX QUEUES define HOST MAX PARTITION MEM POOLS define HOST MAX DYNAMIC MEM POOLS define HOST MAX EVENT GROUPS define HOST MAX SEMAPHORES define HOST MAX PROTECTION STRUCTS define HOST USER SHARED
66. ports machine code inserts using the asm and asm_volatile operations These operations have a special syntax that is a mixture of strings colons and parenthesized C variable names This is supported in Ada as follows procedure lt Ada subp name gt lt formal parameter list gt pragma Import Inline Asm Volatile lt Ada subp name gt lt instructionl gt lt instruction2 gt lt output constraintl gt Ada OUT param amp lt input constraintl gt Ada IN param lt clobberregl gt lt clobberreg2 This has the same format as the C inline asm operation except e everything is enclosed in a single level of quotes e the names used are the Ada formal parameter names OUT parameters may appear only in the output section IN parameters may appear only in the input section IN OUT parameters must appear in both with an appropriate digit in the input section After giving the pragma Import with the Inline_Asm convention each call to that procedure will be expanded by the compiler into an inline sequence of instructions the instructions are given in the string literal that is the second argument of the pragma In addition there is a package System Machine_Intrinsics which contains two special procedures procedure Asm Instruction String procedure Asm Volatile Instruction String A call to Asm turns into the corresponding asm statement in C similarly for Asm_Volatile The string must of co
67. pplication OS_TOTAL_SYSTEM_QUEUES MAPUS QFT MAPUS FT The total number of queues for message passing required by the application OS TOTAL SYSTEM MUTEXES The total number of mutex semaphores required by the application OS_TOTAL_SYSTEM_SEMAPHORES The total number of regular binary count semaphores required by the application OS TOTAL SYSTEM DM POOLS 100 The total number of dynamic variable memory pools required by the One control block will be used by the application OS Application Init function when the INCLUDE OS PROCESS option is true OS TOTAL SYSTEM PM POOLS 100 The total number of partitioned fixed size memory pools required by the application OS_TOTAL_SYSTEM_TM_POOLS The total number of Tiered memory pools required by the application OS_TOTAL_SYSTEM_TSM_POOLS The total number of Tiered shared memory pools required by the application OS_TOTAL_SYSTEM_EV_GROUPS The total number of event groups required by the application OS_TOTAL_SYSTEM_TIMERS The total number of application timers required by the application OS_TOTAL_SYSTEM_HANDLES The total number of system Handles required by the application System Configuration Guide NOTE The first control block of Task Queue Dynamic Memory and Semaphore is reserved for internal use in the OS Abstractor Interface MAPUS QFT MAPUS QFT System Configuration Guide The following are the addi
68. r if memory is tight package Simple_Interrupt_Test is This is the root package of the example end Simple_Interrupt_Test package Simple_Interrupt_Test Handlers is This package creates an interrupt handler for the SFTOI interrupt The interrupt handler is the protected procedure Handler inside the protected object Handler PO This interrupt handler simply counts the number of interrupts this number is returned by Number_Of_Interrupts pragma Elaborate_Body protected Handler_PO is procedure Handler The interrupt handler pragma Attach_Handler Handler SFTOI MAPUS QFT MAPUS QFT function Number_Of_Interrupts return Natural Return number of interrupts that have occurred so far private System Configuration Guide Count Natural 0 end Handler_PO end Simple_Interrupt_Test Handlers package body Simple_Interrupt_Test Handlers is protected body Handler_PO is procedure Handler is begin Count Count 1 end Handler function Number_Of_Interrupts return Natural is begin return Count end Number_Of_Interrupts end Handler_PO end Simple_Interrupt_Test Handlers with System Machine_Intrinsics with Simple_Interrupt_Test Handlers use Simple_Interrupt_Test Handlers procedure Simple_Interrupt_Test Main is This is the main procedure It simulates an external interrupt 10 times by calling Generate_Interrupt and prints out the number each time procedure Generate_Interr
69. r in the debugger as My package My global Effectively every in the full expanded name has been converted to _ with the next letter in upper case If the Ada variable or subprogram is declared in the package body rather than in the package spec then two underscores separate the package name from the variable or subprogram name Hence a variable from the body such as My_Package My_Hidden_Global would appear in the debugger as My_package__My_hidden_global Nested Subprograms and Up level References If a variable is declared in a subprogram that has nested subprograms and at least one of those nested subprograms makes an up level reference to the variable then the variable is moved into a frame record and the whole frame record is passed to each of the nested subprograms to support up level access The frame record of the current subprogram if any is called this_frame in the debugger and the frame record of the enclosing subprogram if any is pointed to by a parameter called parent_frame If you can t find a local variable you expected to see and the current subprogram has nested subprograms then take a look in the local variable called this_frame If it exists it might contain the local variable you were looking for Similarly if you are looking for a variable from an enclosing subprogram look through the parent_frame parameter If the variable is multiple levels
70. rable system overhead and memory The underlying OS thread creation function call can take considerable amount of time to complete the operation and could fail if there is not enough system memory Enabling this feature Applications can create OS Abstractor tasks during initialization and be able to re use the task envelope again and again To configure task pooling set the following pre processor flag as follows Table 2_10 OS Abstractor Task Pooling Feature Selection Flag and Purpose Available options INCLUDE OS TASK POOLI OS TRUE Include OS Abstractor task pooling NG feature to allow applications to re use task envelops from task pool created during initialization to eliminate run time overhead with actual resource creation and deletion OS FALSE Do not include task pooling support The default is OS FALSE Except for the performance improvement this behavior will be transparent to the application Each process application will contain its own individual task pool Any process which requires a task pool must successfully add tasks to the pool before it can be used Tasks can be added to via OS_Add_To_Task Pool function or removed via OS Remove From Task Pool function from a task pool at anytime When an application makes a request to use a pool task OS Abstractor will first search for a free task in the pool with an exact match based on stack size If it does not find a match then a free task with the
71. ration OS Abstractor Interface Clock Tick Configuration OS Abstractor Interface Device I O Configuration OS Abstractor Interface Target OS Specific Notes Runtime Memory Allocations OS Abstractor Process Feature Simple single process Versus Complex multiple process Applications MAPUS QFT MAPUS QFT System Configuration System Configuration Guide The user configuration is done by setting up the appropriate value to the pre processor defines found in the cross_os_usr h NOTE Make sure the OS Abstractor Interface libraries are re compiled and newly built whenever configuration changes are made to the os_target_usr h when you build your application In order to re build the library you would actually require the full source code product version not the evaluation version of OS Abstractor Interface Applications can use a different output device as standard output by modifying the appropriate functions defines in os_target_usr h along with modifying os_setup_serial_port c module if they choose to use the format Input output calls provided by the OS AbstractorInterface MAPUS QFT MAPUS QFT Target OS Selection Based on the OS you want the application to be built set the pre processor definition in your project setting or make files by using the Table 2_1 System Configuration Guide Table 2_1 Set the Pre processor Definition For Selected Target OS Flag and Purpose Available Options OS_TARGET The value o
72. re be turned off for the production release of your application If the profiler feature is turned OFF then the profiler hooks disappear within the OS Abstractor and as such there are no impacts to the OS Abstractor API performance Special Notes Profiler feature is not supported in ThreadX and Nucleus targets OS Abstractor Output Device Selection The following are the user configuration options and their meanings Table 2_12 OS Abstractor Output Device Selection Flag and Purpose Available options OS_STD_OUTPUT Output device to print OS SERIAL OUT Print to serial OS WIN CONSOLE Print to console User can print to other devices by modifying the appropriate functions within os_setup_serial_port c in the OS Abstractor source directory and use OS Abstractor s format Input Output calls The default value is OS_WIN_CONSOLE OS Abstractor Debug and Error Checking Table 2_13 OS Abstractor Debug and Error Checking Flag and Purpose Available Options OS_DEBUG_INFO OS DEBUG MINIMAL print debug info fatal and compliance errors OS_DEBUG_VERBOSE print the debug information Fatal Error amp Compilation Error elaborately OS_DEBUG_DISABLE do not print debug info The default value is OS DEBUG MINIMAL OS_ERROR_CHECKING OS TRUE Check for API usage errors OS FALSE do not check for errors Use this option to increase performance and reduce code size The default value is OS_TRUE
73. read will never get launched by the target OS It is also safe to use a value greater than or equal to OS_STACK_SIZE_MIN defined in def h OS Abstractor ensures that OS_STACK_SIZE_MIN is always greater that the minimum stack size requirement set by the underlying target OS Dead Synchronization Object Monitor Use OS_Monitor_Register function to register a process as a dead synchronization object monitor A dead synchronization object situation can occur if a process is terminated while it owns a synchronization object such as a mutex or a pthread_spinlock When this happens any other processes suspended on that object will never be able to acquire it This situation can only occur if the synchronization object is shared between processes For further information about OS_Monitor_Register function refer to the OS Abstractor Interface Reference Manual MAPUS QFT MAPUS QFT VxWorks Target Version Flags System Configuration Guide The following is the compilation defines that has to be set when building the OS Abstractor library for VxWorks target OS Table 2_24 Version Flags for VxWorks Target Compilation Flag Meaning OS_VERSION Specify the VxWorks version The value can be OS_VXWORKS_5X VxWorks 5 x or older OS_VXWORKS 6X Versions 6 x or higher OS_USER_MODE Set this value to OS_TRUE if the OS Abstractor is required to run as a application module Under OS_VXWORKS_5X the OS KERNEL MODE flag is ignored The
74. returns even if the device generates the interrupt right away that s because of the priority rules Also the interrupt handler might get some information from the device save it locally in the protected object and then the entry body might pass this information back to the task via an out parameter In other words a protected object used in this way acts as a device MAPUS QFT MAPUS FT System Configuration Guide driver containing operations to initiate I O operations to wait for operations to complete and to handle interrupts Anything that needs to be done while masking the interrupt of the device should be part of the protected object Note that if multiple device drivers are needed for similar devices it is convenient to declare a protected type and declare multiple objects of that type Discriminants can be used to pass in information specific to individual devices with Ada Interrupts Names use Ada Interrupts Names with Ada Magic DBG use Ada Magic DBG package Interrupt Test With Entries is Empty end Interrupt Test With Entries package Interrupt Test With Entries Handlers is pragma Elaborate Body protected Handler PO is procedure Handler The interrupt handler pragma Attach Handler Handler SFTOI entry Await Interrupt Each time Handler is called this entry is triggered private Interrupt Occurred
75. ronment Application Operating Guide Provides detailed description of how to do porting and abstraction using AppCOE This guide e Explains how to port applications Explains how to import legacy applications Explains how to do code optimization Explains how to generate library packages Explains on Application profiling and platform profiling OS Abstractor Reference Manual Interface Provides detailed description of how to use OS Abstraction This guide e Explains how to develop code independent of the underlying OS e Explains how to make your software easily support multiple OS platforms POSIX Interface Reference Manual Provides detailed description of how to get started with POSIX interface support that MapuSoft provides This guide e Explains how to use POSIX applications interface port micron ITRON Reference Manual Interface Provides detailed description of how to get started with micron ITRON interface support that MapuSoft provides This guide e Explains how to use micron ITRON interface port applications psOSs Manual Interface Reference Provides detailed description of how to get started with pSOS interface support that MapuSoft provides This guide e Explains how to use applications psOS interface port psOS Classic Interface Reference Manual Provides detailed description of how to get started with pSOS Classic interface support that MapuSoft provides
76. rt Centre If you are a customer with an active MapuSoft support contract or covered under warranty and need post sales technical support you can access our tools and resources online or open a ticket at http www mapusoft com support System Configuration Guide Registering a New Account To register From http www mapusoft com main page select Support Select Register and enter the required details After furnishing all your details click Submit Submitting a Ticket 1 To submit a ticket 1 From http www mapusoft com main page select Support gt Submit a Ticket 2 Select a department according to your problem and click Next 3 Fill in your details and provide detailed information of your problem 4 Click Submit MapuSoft Support personnel will get back to you within 48 hours with a valid response 2 To submit a ticket from AppCOE 1 From AppCOE main menu Select Help gt Create a Support Ticket as shown in below Figure Figure Create a Support Ticket from AppCOE BERR ERE SY prekderre EJ Console Propert s Ada Changer Tids Coresi dere ads tes MAPUS QFT System Configuration Guide 2 Using the Existing Email and Password for login into Mapusoft Support Suite 3 Select the department according to your problem and click Next 4 Fill in your details and provide detailed information of your problem 5 Click Submit MapuSoft Support personnel will get back to you within 48 hours with a v
77. ructure in de_init e IOPARMS structure in de open e IOPARMS structure in de read Nucleus Interface All of the following allocations use OS_Allocate_Memory using the System_Memory pool Thus all these allocations come from the calling processes memory pool e Message in nu_receive_from_pipe This is deallocated before leaving the function call Message in nu_receive_from_queue This is deallocated before leaving the function call Message in nu_send_to_front_of_pipe This is deallocated before leaving the function call Message in nu_send_to_front_of_queue This is deallocated before leaving the function call Message in nu_send_to_pipe This is deallocated before leaving the function call Message in nu_send_to_queue This is deallocated before leaving the function call MAPUS QFT MAPUS QFT ThreadX Interface All of the following allocations use OS_Allocate_Memory using the System_Memory pool Thus all these allocations come from the calling processes memory pool System Configuration Guide e Message in tx_queue_receive This is deallocated before leaving the function call e Message in tx_queue_send This is deallocated before leaving the function call Message in tx_queue_front_send This is deallocated before leaving the function call MAPUS QFT MAPUS QFT OS Abstractor Process Feature System Configuration Guide An OS Abstractor process or an application process is an individual module
78. rupt Handling System Configuration Guide This section explains how to write interrupt handlers The basic Ada mechanisms for interrupt handling are described in RM C 3 please read that first You will also need to read the interrupt related parts of your target s hardware manual NOTE If you want to write an interrupt handler that does not do any Ada tasking related operations such as protected procedure calls then you can use your target s RTOS mechanisms directly instead of the mechanisms described here The basic idea is that a protected procedure can be attached as an interrupt handler If the procedure should be permanently attached throughout the execution of the program use pragma Attach Handler to attach it If the procedure needs to be attached and detached and reattached from time to time during execution then first use pragma Interrupt Handler to mark that procedure as a potential interrupt handler Then use operations in package Ada Interrupts to attach and detach the procedure The example hardware the Analog Devices SHARC supports 32 interrupts These are given names in package Ada Interrupts Names which is shown here package Ada Interrupts Names is Hardware interrupts If interested in further detail on this example page F 1 of the ADSP 2106x SHARC User s Manual Second Edition Reserved 0 constant Interrupt_ID 0 RSTI constant Interrupt_ID 1 reserved Reset read only non maskabl
79. rupts and we have a task Waiting Task that waits for them MAPUS QFT MAPUS QFT using a suspension object called Interrupt_Occurred System Configuration Guide Note that if the task is already waiting the usual case when the interrupt occurs Interrupt_Occurred is only set to True momentarily Suspend_Until_True automatically resets it to False If the task is not waiting then the True state will be remembered and when the task gets around to waiting it will reset it to False and proceed immediately Note that only one task can wait on a given suspension object it s sort of like a protected object with an entry queue of length one which allows it to be implemented more efficiently This means that the programmer using suspension objects has to know which task will do the waiting it s as if that task has a kind of ownership of that particular suspension object with Ada Interrupts Names use Ada Interrupts Names with Ada_Magic DBG use Ada_Magic DBG package Suspension_Objects_Test is Empty end Suspension_Objects_Test with Ada Synchronous_Task_Control use Ada Synchronous_Task_Control package Suspension_Objects_Test Handlers is pragma Elaborate_Body protected Handler_PO is procedure Handler The interrupt handler pragma Attach_Handler Handler SFTOI end Handler_PO Interrupt_Occurred Suspension Object Default initialized to False
80. s to be set to 20 The MQX TASK DESTRUCTION macro is located in source include mqx_cnfg h in your MQX installation Set it to zero as shown below or pass it to compiler via pre processor setting in your project make files ifndef MQX TASK DESTRUCTION define MQX TASK DESTRUCTION 0 endif The BSP_DEFAULT_MAX_MSGPOOLS macro is located in source bsp bspname bspname h in your MQX installation where bspname is the name of your BSP Set the required value as follows define BSP DEFAULT MAX MSGPOOLS 20L MAPUS QFT MAPUS FT Linux Target System Configuration Guide User Vs ROOT Login OS Abstractor internally checks the user ID to see if the user is ROOT or not If the user is ROOT then it will automatically utilize the Linux real time policies and priorities It is always recommended that OS Abstractor application be run under ROOT user login In this mode e OS Abstractor task priorities time slice pre emption modes and critical region protection features will work properly e OS Abstractor applications will have better performance and be more deterministic behavior since the Linux scheduler is prevented to alter the tasks priorities behind the scenes e Also when you load other Linux applications that uses the default SCHED_OTHER policies they will not impact the performance of the OS Abstractor applications that are running under real time priorities and policies Under non ROOT user mo
81. sr h Table 2 11 OS Abstractor Profiler Feature Selection Flag and Purpose Available Options OS_PROFILER Profiler feature allows applications running on the target to collect valuable performance data regarding the application s usage of the OS Abstractor APIs Using the AppCOE tool this data can then be loaded and analyzed in graphical format You can find out how often a_ specific OS Abstractor API is called across the system or within a specific thread You can also find out how much time the functions took across the whole system as well as within a specific thread Profiler feature uses high resolution clock counters to collect profiling data and this implementation may not be available for all target CPU and OS platforms Please contact MapuSoft for any custom high resolution timer implementation required for the profiler for your target OS environment Refer to OS Get Hr Clock Freq and OS Read Hr Clock for additional details on what target OS platforms are currently supported by the profiler If profiler feature is turned ON then it needs to use the open read write calls to write to profiler data file If you set OS MAP ANSI IO to OS TRUE then make sure you install the appropriate file device and driver Can either be OS TRUE Profiler feature will be included Profiling takes place with each OS Abstractor API call If profiler is turned on also set the value for the follow
82. st and you will be confused as to why your program doesn t work To help in debugging you can write your interrupt handlers like this protected body Handler PO is procedure Handler is Nothing here begin declare If you want local variables put them here so if their elaboration raises an exception it will be handled below begin end exception when X others gt Put Line Exceptions Exception Name X amp raised in interrupt handler end handler The exception handler can log the error and or take some other appropriate action Here it just prints something like Constraint_Error raised in interrupt handler to standard output NOTE There is some time overhead associated with having the exception handler Priorities Interrupt handlers run at interrupt priority which means they are higher priority than normal tasks More precisely the ceiling priority of the protected object containing the interrupt handler is an interrupt level priority Thus not only does the interrupt handler run at interrupt level but so do all other operations of the same protected object In the examples below procedure Handler and entry Await_Interrupt will both execute at interrupt level locking out other tasks Package System has subtype Priority is Integer range 1 30 subtype Interrupt Priority is Integer range 31 31 subtype Any Priority is Integer range Priority First Interrupt Pri
83. t SFTOI end loop MAPUS QFT MAPUS QFT Put_Line Integer Image Handler_PO Number_Of Interrupts System Configuration Guide amp interrupts end Simple_Interrupt_Test Main Example 2 The second example prints the following Hello from Interrupt_Test_With_Entries main procedure Generating interrupt Waiting Task Got interrupt Generating interrupt Waiting Task Got interrupt Generating interrupt Goodbye from Interrupt_Test_With_Entries main procedure Waiting Task Got interrupt Goodbye from Waiting Task This example illustrates how an interrupt handler a protected procedure may communicate with a task using an entry The interrupt handler is called when the interrupt occurs and it causes the entry s barrier to become True The task waits by calling the entry it is blocked until the barrier becomes True In this example we simulate 10 interrupts and we have a task Waiting Task that waits for 10 interrupts by calling the entry Each interrupt triggers one call to the entry to proceed In this example the only information being transmitted back to the waiting task is the fact that the interrupt has occurred Ina real program the protected object might have additional operations to do something to some external device e g initiate some I O This might cause the device to generate an interrupt The interrupt would not be noticed until after this operation
84. t main procedure MAPUS QFT MAPUS FT for I in 1 10 loop System Configuration Guide delay 0 01 Put_Line Generating interrupt Generate_Interrupt SFTOI end loop Put_Line Goodbye from Suspension_Objects_Test main procedure end Suspension_Objects_Test Main MAPUS QFT MAPUS FT Implementation Defined Pragmas System Configuration Guide The following implementation defined pragmas are supported pragma Assert boolean expression static string expression This pragma is allowed wherever a declaration or a statement is allowed The boolean_expression is evaluated and Program_Error is raised if the value is not True The string expression is currently ignored At some future date we intend to add a separate package to support the pragma Assert and raise an Assert_Error exception instead Note that the check associated with a pragma Assert can be suppressed with a pragma Suppress Assertion_Check or a pragma Suppress All_Checks pragma C Pass By Copy Max_Size gt static _integer_ expression This is a configuration pragma The expression may be of any integer type This pragma affects the parameter passing conventions of structs in subprograms whose convention is C Any struct whose size is less than or equal to that specified by this pragma will be passed by copy larger structs will be passed by reference The Max_Size is measured in storage elements Without this pragma all structs
85. te_temps which has the same effect as the pragma pragma Unchecked Union Entity gt first subtype local name This is a representation pragma It causes the discriminant to be omitted from an Ada variant record type in order to interface to a C union type The discriminant can be and in fact must be specified in aggregates but it is not allocated any space at run time Pragma Interface This pragma is a synonym for pragma Import It is provided for backward compatibility new code should use pragma Import instead Pragmas Memory Size Storage Unit System_Name These pragmas are ignored They are provided for compatibility with Ada 8 MAPUS QFT MAPUS QFT Debugging Ada Programs System Configuration Guide This section contains advice for debugging using a C debugger Source File Display in a C debugger The AdaMagic Compiler generates optimized ANSI C as its intermediate language which is then compiled by an ISO ANSI C compiler to produce object modules When given the ga flag g for debugger a for Ada source display the AdaMagic compiler will generate line directives in the generated C source which will allow a typical C debugger e g gdb to trace the generated object code back to the original Ada source file and line that produced it Alternatively when given the gc flag g for debugger c for C source display the generated intermediate C will be saved with C comm
86. that contains one or more tasks and other resources A process can be looked as a container that provides encapsulation from other process The OS Abstractor processes only have a peer to peer relationship and not a parent child relationship An OS Abstractor process comes into existence in two different ways Application registers a new OS Abstractor process when it calls OS_Application_Init function Application also launches a new process when it calls the OS_Create_Process function In the later case the newly launched process does not automatically inherit the open handles and such however they can access the resources belonging to the other process if they are created with system scope Under process based operating system like Linux this will be an actual process with virtual memory addressing As such the level of protection across individual application will be dependent on the underlying target OS itself Under non process based operating system like Nucleus PLUS a process will be a specialized task similar to a main thread owning other tasks and resources in a single memory model based addressing The resources are protected via OS Abstractor software This protection offered by OS Abstractor is software protection only and not to be confused with MMU hardware protection in this case OS Abstractor automatically tracks all the resources tasks threads semaphores etc and associates them with the process that created th
87. tion call e Message in mq_timedsend This is deallocated before leaving the function call All of the following are specific to the TKernel OS and use the SMalloc api call These will not be accounted for in the process memory pool e Parameter list for execve e INT PX FIFO DATA structure in fopen All of the following are specific to the TKernel OS and use os_malloc_external API call These will not be accounted for in the process memory pool e Buffer for getline e Globlink structure in int_os_glob_in_dir e Globlink name in int os glob in dir e Directory in int 0 prepend dir micro ITRON Interface All of the following allocations use OS Allocate Memory using the System Memory pool Thus all these allocations come from the calling processes memory pool e Message in snd dtq This is deallocated before leaving the function call e Message in psnd dtq This is deallocated before leaving the function call e Message in tsnd dtq This is deallocated before leaving the function call Message in fsnd_dtq This is deallocated before leaving the function call Message in rcv_dtq This is deallocated before leaving the function call Message in prcv_dtq This is deallocated before leaving the function call Message in trcv_dtq This is deallocated before leaving the function call Message in snd_mbf This is deallocated before leaving the function call Message in psnd_mbf This is deallocated before leaving the function call Message in tsnd_mbf
88. tional resources required internally by OS Abstractor Table 2_17 Additional resources required internally by OS Abstractor Resources Linux POSIX Vxworks pSOS Windows uCOS QNX MQX ThreadX Nucleus ulTRON NetBSD Solaris LynxOS Android Targets 2 Semaphore required if application uses uitron Interface for above mentioned target 1 Event Group required by OS Abstractor for signaling support in posix for above mentioned target 1 Event group required if application uses POSIX Interface and or VxWorks Interface and or pSOS Interface for above mentioned target 1 Event Group required by OS Abstractor if application uses task pooling for above mentioned target DYNAMIC_POOL 1 Event Group required by OS Abstractor for above mentioned target but not for MQX Target 2 Semaphores used by OS Abstractor for above mentioned target 1 Semaphore used by POSIX Interface for above mentioned target Additional Queues required by OS Abstractor if application uses profiler for above mentioned target 1 Additional Semaphore required by OS Abstractor Additional Protection Structure required by OS Abstractor for above mentioned target PROCESS 1 DM_POOL used by OS Abstractor for above mentioned target 1 Event Group required by OS Abstractor for above mentioned target 1 Additional Task required by OS Abstractor for above mentioned target e 2 Protection Structures required by OS Abstractor for above mentioned target
89. to 10ms However the 0S TIME TICK PER SEC could be different under other real time or proprietary Linux distributions Also make sure you modify 0S DEFAULT TSLICE value to match with your application needs if necessary By default this value is set for the time slice to be 100ms Memory Heap OS Abstractor uses the system heap directly to provide the dynamic variable memory allocation The Memory management for the variable memory is best left for the Linux kernel to be handled so OS Abstractor only does boundary checks to ensure that the application does not allocate beyond the pool size The maximum memory the application can get from these pools will depend on the memory availability of the system heap Priority Mapping Scheme QNX native priority value of 255 will be reserved for OS Abstractor Exclusivity The rest of the 255 QNX priorities will be mapped as follows O to 253 OS Abstractor priorities gt 254 to 1 QNX priorities 254 and 255 OS Abstractor priorities gt 0 QNX priority The OS Abstractor uses priorities 0 255 plus one more for exclusivity which results in a total of 257 Memory and System Resource Cleanup Please refer to the same section under target specific notes for Linux operating system Task s Stack Size The stack size has to be greater than PTHREAD STACK MIN defined by Linux otherwise any OS Abstractor or OS Changer task creation will return success but the actual task pth
90. upport You will need this To include POSIX Interface option turned ON either if the underlying OS product component does not support POSIX or you need to POSIX provided by OS Abstractor Interface instead of the POSIX provided natively by the target OS OS FALSE Do not include support The default is OS_FALSE NOTE The above component can be used across POSIX based and non POSIX based target OS for gaining full portability along with advanced real time features POSIX Interface library will provide the POSIX functionality instead of application using POSIX functionalities directly from the native POSIX from the OS and as a result this will ensure that your application code will work across various POSIX UNIX based target OS and also its various versions while providing various real time API and performance features In addition OS Abstractor Interface will allow the POSIX application to take advantage of safety critical features like task pooling fixing boundary for application s heap memory use self recovery from fatal errors etc these features are defined elsewhere in this document For added flexibility POSIX applications can also take advantage of using OS Abstractor Interface APIs non intrusively for additional flexibility and features MAPUS QFT MAPUS QFT OS Abstractor Process Feature Selection System Configuration Guide Table 2_9 OS Abstractor Process Feature Selection Flag and Purpose Avail
91. upt Interrupt Ada Interrupts Interrupt_ID is This uses machine code intrinsics to simulate a hardware interrupt by generating an interrupt in software use System Machine_Intrinsics This sets the N th bit in IRPTL where N is the interrupt number which causes the interrupt to happen see page 3 26 of the ADSP 2106x SHARC Users Manual Second Edition We want to use the BIT SET instruction so it s atomic but that instruction requires an immediate value we can t calculate 2 N and use that as the mask hence the rather repetitive code below procedure Gen 0 is pragma Inline Gen 0 begin MAPUS QFT MAPUS FT Asm BIT SET IRPTL 0x00000001 System Configuration Guide end Gen 0 procedure Gen_1 is pragma Inline Gen_1 begin Asm BIT SET IRPTL 0x00000002 end Gen 1 procedure Gen 31 is pragma Inline Gen 31 begin Asm BIT SET IRPTL 0x80000000 end Gen 31 subtype Handleable Range is Ada Interrupts Interrupt_ID range 0 31 These are the only interrupts that actually exist in the hardware begin case Handleable_Range Interrupt is when 0 gt Gen 0 when 1 gt Gen 1 when 2 gt Gen_2 when 31 gt Gen 31 end case end Generate_Interrupt begin Put_Line Hello from Simple Interrupt Test main procedure for I in 1 10 loop Put_Line Integer Image Handler_PO Number_Of_Interrupts amp interrupts so far Generate_Interrup
92. urse be known at compile time for example a double quoted string literal or if that won t fit on a line several string literals concatenated together with amp The string literals may include assembler directives macro calls include statements and so forth in addition to actual machine code instructions Example with System Machine Instructions package body is procedure Disable Interrupts is use System Machine Instructions begin asm include lt def21060 h gt asm bit clr MODE1 IRPTEN end Disable Interrupts MAPUS QFT MAPUS QFT Implementation Defined Conventions System Configuration Guide As explained above the following implementation defined conventions may be used in pragmas Convention Import and Export e C e C Pass By Copy e Inline Asm Inline_Asm_Volatile Program_Memory The entity mentioned in the pragma must be a library level object it must not be nested in any subprogram It must not be aliased The generated C code must represent the object as a static or extern variable for example the object cannot be dynamic sized because that requires an extra indirection in the generated C code If you specify convention Program_Memory then the Ada compiler generates pm in the C code This causes the C back end to allocate the object in program memory rather than the default data memory See the C compiler manual for more details MAPUS QFT MAPUS FT Inter
93. us example nd Generate Interrupt begin Generate 10 simulated interrupts with delays in between Put_Line Hello from Interrupt Test With Entries main procedure for I in 1 10 loop MAPUS QFT MAPUS QFT delay 0 01 System Configuration Guide Put _ Line Generating interrupt Generate Interrupt SFTOI end loop Put Line Goodbye from Interrupt Test With Entries main procedure end Interrupt Test With Entries Main Example 3 The third example prints the following Hello from Suspension_Objects_Test main procedure Generating interrupt Waiting Task Got interrupt Generating interrupt Waiting Task Got interrupt Generating interrupt Waiting Task Got interrupt Generating interrupt Waiting Task Got interrupt Goodbye from Waiting Task Generating interrupt Generating interrupt Generating interrupt Generating interrupt Generating interrupt Generating interrupt Goodbye from Suspension_Objects_Test main procedure This example illustrates how an interrupt handler a protected procedure may communicate with a task using a suspension object A suspension object allows a task or interrupt handler to notify another task that some event in our case an interrupt has occurred Each time the interrupt occurs the suspension object is set to True The task waits for this event by calling Suspend_Until_True In this example we simulate some inter
94. x components If your Linux kernel is configured to have less than 257 priorities the OS Abstractor will automatically configuring a windowing scheme where multiple number of OS Abstractor priorities will map to a single Linux priority Because of this the reported priority value could be slightly different than what was used during the task creating process If your application uses the pre processor called OS_DEBUG_INFO then all the priority values and calculations will be printed to the standard output device Memory and System Resource Cleanup OS Abstractor uses shared memory to support multiple OS Abstractor and OS Changer application processes that are built with OS_INCLUDE_PROCESS mode set to OS_TRUE MAPUS QFT MAPUS QFT Single process Application Exit System Configuration Guide This will apply to application that does not use the OS_PROCESS feature Each application needs to call OS_Application_Free to unregister and free OS Abstractor resources used by the application Under circumstances where the application terminates abnormally the applications need to install appropriate signal handler and call OS_Application_Free within them Multi process Application Exit This will be the case where the applications are built with OS_PROCESS feature set to OS_TRUE When the first multi process application starts shared memory is created to accommodate all the shared system resources for all the multi process application When su

Download Pdf Manuals

image

Related Search

Related Contents

High Wall Platinum Manual de instalación  operação do sistema interligado nacional durante o ano novo  Datenblatt - Beamer  NewElec KD / KE Relay Bootloader User Manual  型式承認申請ガイド(タクシーメーター)(PDFファイル)  Samsung Laserskrivere Monolaser ML-5510ND Bruksanvisning  

Copyright © All rights reserved.
Failed to retrieve file