×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / Wish experts answer my questions in c programming under Unix in a real time system: Thanks! 1. how to enlarge the stack size in a c program? 2. should main() be the driver function in in a c program?
    1. how to enlarge the stack size in a c program?
    2. should main() be the driver function in in a c program?
    • 请进, UNIX不是REALTIME SYSTEM, 下面我就RTOS来说说,适合于NUCLEOUS或者VXWORKS
      1。 一般在RTOS里面,你得在SHELL里亲自启动一个TASK, 或者在程序里SPAWN另一个TASK。一般来说STACK SIZE是通过PARAMETER传递进去的。比如WINDRIVER的taskSpawn()
      2. 在RTOS中,切忌不要用MAIN(〕来做ENTRY POINT。 因为RTOS一般是个小的操作系统, 没有PROCESS的MEMORY保护,
      操作系统本身就是一个MAIN(〕,所以你要定义MAIN,就是重复定义GLOBAL SYMBOL
      • 我认为并不是所有的REAL-TIME OS 不允许以MAIN()为应用程序的ENTRY POINT,如PSOS+。NUCLEOUS 有MAIN()只是实现很简单的功能而且从不返回,并不是因为没有PROCESS的MEMORY保护。
        • Good point! But I get another question here. Since the OS itself a main(), should all other called functions be written somewhere in OS? otherwise how can an application be execuated?
          • Hi Numnum. such program is compiled in Solaris but finally run under MTOS.
          • If you want a RTOS to run your application, you compile your source code and make it a relocatable module(in ELF relocatable format, for example).
            Then you download this module into the RTOS, the dowanload untiliy in the RTOS can analyze your symbol table,
            global offset table, etc. And it merges your module symbol table with
            the kernel symbol table , as well as calculate relocated addresses.
            After that, it looks like that your application is included in the RTOS kernel.
            The only thing you need to do is to invoke the proper function from Shell
            • Thanks! Your opinion is really helpful! But I'm afraid my case a bit different. I uploaded my relocatable module by ftp, which can't analyze the symbol table.
              Thanks! Your opinion is really helpful!
              But I'm afraid my case a bit different. I uploaded my relocatable module by ftp, which can't analyze the symbol table. I could compile
              MTOS as a standalone package, and compile my application as another standalone package. The application program might call some ground
              functions from MTOS.
              I don't know how the application program included in the OS kernel. Finally I invoke the application program from Shell.