📄 micrium1.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0055)http://www.ucos-ii.com/contents/support/faqs-test1.html -->
<HTML><HEAD><TITLE>Micrium</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><LINK
href="Micrium1.files/white-micrium3.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0"
marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD><IMG height=30 src="Micrium1.files/title-faqs.gif"
width=540></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=10 width=600 border=0>
<TBODY>
<TR>
<TD>
<P><BIG><STRONG><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-01">FAQ-01</A>:
</STRONG><B>My computer/processor 'hangs' when I run 礐/OS or
礐/OS-II!</B><FONT color=#0000ff> <BR></FONT></BIG><STRONG><BR><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-02"><BIG>FAQ-02</BIG></A><BIG>:
</BIG></STRONG><BIG><STRONG>Are you allowed to send a NULL-pointer through
a Mailbox or a
Queue</STRONG><BIG>?<BR></BIG><STRONG><BR></STRONG></BIG><STRONG><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-03"><BIG>FAQ-03</BIG></A><BIG>:
Where should I enable the 'tick'
interrupt?</BIG></STRONG><BIG><STRONG><BR></STRONG></BIG><STRONG><BIG><BIG><BR></BIG></BIG><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-04"><BIG>FAQ-04</BIG></A><BIG>:
</BIG></STRONG><BIG><STRONG>Does 礐/OS and 礐/OS-II work with Microsoft
C/C++?<BR></STRONG></BIG><STRONG><BIG><BIG><BR></BIG></BIG><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-06"><BIG>FAQ-05</BIG></A><BIG>:
</BIG></STRONG><BIG><STRONG>Are there other ports available for 礐/OS and
礐/OS-II?</STRONG></BIG> </P>
<P align=left><STRONG><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-06"><BIG>FAQ-06</BIG></A><BIG>:
Is there a better way to implement OSIntCtxSw() and
ISRs?<BR>
</BIG></STRONG><BIG><FONT color=#0000ff>(Added 2001/01/26)</FONT></BIG>
</P>
<P align=left> </P>
<TABLE width="100%" border=1>
<TBODY>
<TR>
<TD width="100%" bgColor=#c0c0c0>
<P align=left><BIG><STRONG>FAQ-01: My computer/processor 'hangs'
when I run 礐/OS or 礐/OS-II!</STRONG></BIG><A
name=FAQ-01></A></P></TD></TR></TBODY></TABLE>
<P align=left><FONT size=4>DOS executables for 礐/OS and 礐/OS-II are
provided on the diskette. If 礐/OS (or 礐/OS-II) still hangs with the
executable provided on the floppy, try to contact me at <A
href="mailto:Jean.Labrosse@uCOS-II.com">Jean.Labrosse@uCOS-II.com</A>. If
礐/OS (or 礐/OS-II) does not hang with the executable provided on the
floppy then there are two possible reasons your computer could
crash:</FONT> </P>
<P align=left><FONT size=4><FONT color=#ff0000><B>1) </B></FONT>You need
to look at <FONT face="Courier New"><STRONG>OSIntCtxSw</STRONG></FONT>
(pages 62, 63 and 67 in the 礐/OS book or pages 200 and 201 in 礐/OS-II)
which is processor and compiler specific. The very first instruction
in <STRONG><FONT face="Courier New">OSIntCtxSw()</FONT></STRONG> may need
some adjustment, i.e. <FONT face="Courier New"><STRONG>ADD
SP,8</STRONG></FONT>. If you use another processor, compiler or
memory model, you may need to adjust the constant. This
section in the book will explain how to determine the 'magic number' to
add to the stack pointer. </FONT> </P>
<P align=left><FONT size=4>The actual value depends on the compiler used
and the compiler options. For example, on the x86 real-mode small
model, the constant can be either 4, 6, 8, 10 ... For the x86
real-mode, large model, the constant can be either 8, 10, 12, 14, 16
...</FONT></P>
<P align=left><FONT size=4><FONT color=#ff0000><B>2)</B></FONT> You may
want to try removing ANY (and ALL) floating-point operation. The
sample code in example #1 (礐/OS V1.xx and 礐/OS-II V2.00) has a
floating-point operation in the start task. Comment it out (by
putting <FONT face="Courier New"><STRONG>#if 0</STRONG></FONT> / <FONT
face="Courier New"><STRONG>#endif</STRONG></FONT> around the <FONT
face="Courier New"><STRONG>sprintf()</STRONG> </FONT>statement) and try
compiling and running the code. If the code works, the crash is due
to the fact that:<BR><BR> a) The Borland C/C++
floating-point library is non-reentrant.<BR> b) 礐/OS
and 礐/OS-II's task stacks need to be initialized to perform
floating-point operations in a </FONT><BIG><BIG>reentrant way. Refer
to <B><FONT color=#ff0000>AN-1001</FONT></B> for details (See <A
href="http://www.ucos-ii.com/contents/support/support-app_notes.htm">AppNotes</A>).
</BIG></BIG></P>
<P align=left><FONT color=#ff0000 size=4><B>3</B></FONT><FONT size=4><FONT
color=#ff0000><B>)</B></FONT> See </FONT><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#FAQ-06"><B><FONT
color=#ff0000 size=5>FAQ-06</FONT></B></A><FONT size=4>.<BR></FONT></P>
<P align=left><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#TOP"><IMG
height=30 src="" width=67 border=0></A><BR></P>
<TABLE width="100%" border=1>
<TBODY>
<TR>
<TD width="100%" bgColor=#c0c0c0>
<P align=left><BIG><STRONG>FAQ-02: Are you allowed to send a
NULL-pointer through a Mailbox or a Queue?</STRONG></BIG><A
name=FAQ-02></A></P></TD></TR></TBODY></TABLE>
<P align=left><FONT size=4>No. By definition, a NULL-pointer is not
supposed to point to any valid data. You could, however, 'fake'
礐/OS (or 礐/OS-II) into sending <FONT
face="Courier New"><STRONG>NULL</STRONG></FONT> pointers. You will
need to 're-map' a NULL pointer to another 'invalid' pointer. For
example, if you want to send a <FONT
face="Courier New"><STRONG>NULL</STRONG></FONT> through a message mailbox,
you can do the following:</FONT></P>
<P align=left><FONT face="Courier New" size=2>void SenderTask (void
*pdata)<BR>{<BR> .<BR>
.<BR> if (msg == (void *)0) {
/* Do I want to send a NULL pointer ?
*/<BR> msg = (void *)0xFFFFFFFF;
/* Yes, remap to another 'invalid'
pointer */<BR> }<BR> OSMboxPost(Mbox,
msg);<BR> .<BR> .<BR>}<BR><BR><BR>void
ReceiverTask (void *pdata)<BR>{<BR> void
*msg;<BR><BR> .<BR>
.<BR> msg = OSMboxPend(Mbox, 0, &err);
<BR> if (err == OS_NO_ERR)
{<BR> if (msg == (void
*)0xFFFFFFFF) { /* Did I receive a NULL pointer ?
*/<BR>
msg = (void *)0;<BR>
}<BR>
.<BR> .<BR>
}<BR> .<BR> .<BR>} </FONT></P>
<P align=left><A
href="http://www.ucos-ii.com/contents/support/faqs-test1.html#TOP"><IMG
height=30 src="" width=67 border=0></A></P><BIG><BIG>
<TABLE width="100%" border=1>
<TBODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -