From commits-return-9790-archive-asf-public=cust-asf.ponee.io@nuttx.apache.org Mon May 18 14:36:59 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 90A1218062B for ; Mon, 18 May 2020 16:36:59 +0200 (CEST) Received: (qmail 96269 invoked by uid 500); 18 May 2020 14:36:59 -0000 Mailing-List: contact commits-help@nuttx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nuttx.apache.org Delivered-To: mailing list commits@nuttx.apache.org Received: (qmail 96260 invoked by uid 99); 18 May 2020 14:36:58 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2020 14:36:58 +0000 From: =?utf-8?q?GitBox?= To: commits@nuttx.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bincubator-nuttx=5D_patacongo_opened_a_new_issue_?= =?utf-8?q?=231065=3A_Extend_ELF_to_support_stack_size_and_priority?= Message-ID: Date: Mon, 18 May 2020 14:36:58 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit patacongo opened a new issue #1065: URL: https://github.com/apache/incubator-nuttx/issues/1065 ## Backgound ELF is probably the most common binary format in existence. It is used primarily by large desktop systems like Linux but is also used by NuttX. The requirements of a deeply embedded RTOS on a memory limited platform are slightly different. This issues proposes an extension to the ELF header that would extend the capability of ELF for such deeply embedded systems. ## ELF Header Each ELF binary file begins with an ELF header. See https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html for example. Nothing in the header depends on the fixed size for the ELF header. So we are free to extend the ELF header with additional fields at the end of the header with any data that we see fit. There are file offsets in the ELF header that determin the location of data in the file. There is no assumption in the file format that any particular thing follow the ELF header: - e_phoff: This member holds the program header table's file offset in bytes. If the file has no program header table, this member holds zero. - e_shoff: This member holds the section header table's file offset in bytes. If the file has no section header table, this member holds zero. Addition versioning information be required in the header to indicat that this ELF header includes extensions: - e_type: This member identifies the object file type. Which has these defined values: ET_NONE 0 No file type ET_REL 1 Relocatable file ET_EXEC 2 Executable file ET_DYN 3 Shared object file ET_CORE 4 Core file ET_LOOS 0xfe00 Operating system-specific ET_HIOS 0xfeff Operating system-specific ET_LOPROC 0xff00 Processor-specific ET_HIPROC 0xffff Processor-specific I think that 0xfe02 would be a good file type for this extended executable file type. ## Stack Size The first value that needs to included in the extended ELF header is the size of the stack to allocate. This is not an issue for high-end desktop systems because the use effectively unlimited stack space, populating the used regions of the stack on demand by mapping pages into place with the MMU. But memory constrained platforms seldom have an MMU. Instead, a highly tuned, fixed stack size must be provided. Perhaps we would call this `e_stacksize` and it would need a minimum of around 24-bits to represent. ## Priority Desktop systems don't typicall support real-time behavior (and the ones that do, don't support it well). Precise control of task priority is required in order to support a well-behaved, real-time system that can meet all of its deadlines. So the second extension to the ELF header would the the priority of the ELF task, `e_priority`. This would require 8-bits to represent under NuttX. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org