Patent Publication Number: US-2022236982-A1

Title: Software development device and software development program

Description:
TECHNICAL FIELD 
     The present disclosure relates to a software development device and a software development program. 
     BACKGROUND ART 
     The development of information and communication technology (ICT) has been remarkable in recent years, and devices connected to a network, such as the Internet, are not limited to information processing devices, such as conventional personal computers or smartphones, and are spreading to various things. Such a technology trend is called “IoT (Internet of Things)”, and various technologies and services have been proposed and put into practical use. In the future, a world is envisioned in which billions of people on Earth and tens of billions or trillions of devices are connected at the same time. In order to realize such a networked world, it is necessary to provide a solution that is simpler, safer, and more freely connected. 
     With the intelligentization of devices used in IoT (also referred to as “edge devices”), it is necessary to create various kinds of programs. On the other hand, the resources available in the target device are often limited as compared with a personal computer and the like. 
     As an example of a method of creating a program in consideration of available resources, JP 2004-038956 A discloses a system for discovering and showing computing resources available in various computing devices and for exposing these resources as services that can be addressed by software applications. 
     CITATION LIST 
     Patent Document 
     
         
         Patent Document 1: JP 2004-038956 A 
       
    
     SUMMARY OF THE INVENTION 
     Problem to be Solved by the Invention 
     When creating a program executed by an edge device, it is necessary to consider various points in terms of available resources and security. However, Patent Document 1 described above only focuses on creating a program in consideration of the computing resources available in the target computing device, and does not provide a solution to the problem that various points should be considered when creating a program. 
     Means for Solving Problem 
     According to an aspect of the present disclosure, a software development device for generating an object code from a source code is provided. The software development device includes: an evaluation means for extracting restrictions set in a source code and evaluating whether or not the source code conforms to the restrictions within an application range of the extracted restrictions; and a generation means for generating an object code so as to conform to the restrictions. 
     The generation means may stop the generation of the object code when it is evaluated that the source code does not conform to the restrictions within the application range of the restrictions. 
     When it cannot be evaluated whether or not the source code conforms to the restrictions within the application range of the restrictions, the generation means may generate another object code for evaluating whether or not the source code conforms to the restrictions during execution of the object code in addition to the object code corresponding to the source code. 
     The restrictions may include any one of restrictions or rules on resources used by the object code at the time of execution, restrictions or rules on an execution state of the object code, restrictions or rules on an execution procedure of the object code, and restrictions or rules on instructions included in the source code. 
     When a call instruction is included in the application range of the restrictions, the evaluation means may evaluate whether or not an instruction called by the call instruction also conforms to the restrictions. 
     According to another aspect of the present disclosure, a software development program for generating an object code from a source code is provided. The software development program causes a computer to execute: a step of extracting restrictions set in a source code and evaluating whether or not the source code conforms to the restrictions within an application range of the extracted restrictions; and a step of generating an object code so as to conform to the restrictions. 
     Effect of the Invention 
     According to the present disclosure, it is possible to provide an environment in which various restrictions can be freely set for a program executed by an edge device or the like. 
    
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
         FIG. 1  is a schematic diagram showing an example of the overall configuration of an IoT system according to the present embodiment; 
         FIG. 2  is a schematic diagram showing a hardware configuration example of a software development device according to the present embodiment; 
         FIG. 3  is a schematic diagram showing a hardware configuration example of a controller according to the present embodiment; 
         FIG. 4  is a diagram for describing restrictions that can be set by the software development device according to the present embodiment; 
         FIG. 5  is a diagram for describing the scope of restrictions that can be set by the software development device according to the present embodiment; 
         FIG. 6  is a diagram for describing a case where conformity to restrictions that can be set by the software development device according to the present embodiment should be determined at the time of execution; 
         FIG. 7  is a block diagram showing a functional configuration provided by the software development device according to the present embodiment; 
         FIG. 8  is a diagram for describing a method of realizing conformity to restrictions on a call in the software development device according to the present embodiment; 
         FIG. 9  is a flowchart showing a processing procedure for generating an object code from a source code in the software development device according to the present embodiment; and 
         FIG. 10  is a diagram showing an example of a user interface screen provided by the software development device according to the present embodiment. 
     
    
    
     MODE(S) FOR CARRYING OUT THE INVENTION 
     An embodiment according to the present disclosure will be described in detail with reference to the diagrams. In addition, the same or corresponding portions in the diagrams are denoted by the same reference numerals, and the description thereof will not be repeated. 
     In the following description, as a typical example, a case where a software development device  100  according to the present embodiment is applied to an IoT system will be described. However, the present disclosure can be applied to any system and any controller without being limited to the IoT system. 
     A. IoT SYSTEM  1   
     First, the overall configuration of an IoT system  1  including the software development device  100  according to the present embodiment and an edge device  2  will be described. 
       FIG. 1  is a schematic diagram showing an example of the overall configuration of the IoT system  1  according to the present embodiment. Referring to  FIG. 1 , in the IoT system  1 , typically, a program (object code) executed by the edge device  2  is generated by the software development device  100 . The generated program is transferred from the software development device  100  to a controller  200  included in the edge device  2 . 
     An integrated development environment (IDE) is provided for the software development device  100 , so that the user can create an arbitrary program in the integrated development environment. That is, the software development device  100  generates an object code from a source code that is arbitrarily created by the user. 
     The edge device  2  may be any device, but typically, factory facilities, various devices in the home, social infrastructure equipment, movable bodies such as vehicles, arbitrary portable devices, and the like are assumed. As will be described later, the controller  200  has a processor, so that it is possible to execute a program from the software development device  100 . 
     An example of the processing procedure in the IoT system  1  will be described. First, the user creates a source code using the software development device  100  ((1) source code creation). Then, the created source code is compiled by the software development device  100  to generate an object code ((2) object code generation). The generated object code is transferred to the controller  200  of the edge device  2  ((3) object code transfer). The transferred object code is executed by the controller  200  ((4) object code execution). 
     By such a procedure, an arbitrary program developed by the software development device  100  can be executed by the controller  200 . 
     As will be described later, the software development device  100  according to the present embodiment provides an environment in which various restrictions can be freely set for the program executed by the controller  200 . Typically, various restrictions can be set arbitrarily for the program depending on the resources of the controller  200  in which the program is executed, the type and purpose of the edge device  2 , the importance of the program to be executed, the security to be ensured, and the like. By setting such restrictions, it is possible to realize an application using limited resources and prevent the unintended operation of the application. 
     B. HARDWARE CONFIGURATION EXAMPLE 
     Next, a hardware configuration example of a device included in the IoT system  1  according to the present embodiment will be described. 
     (b1: Software Development Device  100 ) 
     The software development device  100  is typically realized by a general-purpose computer. 
       FIG. 2  is a schematic diagram showing a hardware configuration example of the software development device  100  according to the present embodiment. Referring to  FIG. 2 , the software development device  100  includes a processor  102 , a main memory  104 , an input unit  106 , a display  108 , a hard disk  110 , and a communication interface  122  as main components. These components are connected to each other through an internal bus  120 . 
     The processor  102  may be, for example, a CPU (Central Processing Unit) or a GPU (Graphics Processing Unit). A plurality of processors  102  may be disposed, or the processor  102  having a plurality of cores may be adopted. 
     The main memory  104  is a volatile storage device, such as a DRAM (Dynamic Random Access Memory) or a SRAM (Static Random Access Memory). The hard disk  110  holds various programs executed by the processor  102  or various kinds of data. In addition, instead of the hard disk  110 , a non-volatile storage device such as an SSD (Solid State Drive) or a flash memory may be adopted. Among the programs stored in the hard disk  110 , a designated program is loaded to the main memory  104 , and the processor  102  sequentially executes computer-readable instructions included in the program loaded to the main memory  104  to realize various functions described later. 
     Typically, the hard disk  110  stores a source code  112  arbitrarily created by the user, a software development program  114  for realizing an integrated development environment, and an object code  116  generated from the source code  112 . The software development program  114  generates the object code  116  from the source code  112  arbitrarily created by the user, and includes a module that provides a program development environment. 
     The input unit  106  receives an input operation of the user who operates the software development device  100 . The input unit  106  may be, for example, a keyboard, a mouse, a touch panel disposed on a display device, or an operation button disposed on the housing of the software development device  100 . 
     The display  108  displays the processing result of the processor  102  and the like. The display  108  may be, for example, an LCD (Liquid Crystal Display) or an organic EL (Electro-Luminescence) display. 
     The communication interface  122  is in charge of data exchange with the controller  200 . Examples of the communication interface  122  include wired connection terminals, such as serial ports including a USB (Universal Serial Bus) port and an IEEE1394 and a legacy parallel port. Alternatively, the communication interface  122  may include an Ethernet (registered trademark) port. 
     In addition, the entirety or part of the software development device  100  may be realized by using a hard-wired circuit such as an ASIC (Application Specific Integrated Circuit) in which a circuit corresponding to computer-readable instructions is provided. In addition, the entirety or part of the software development device  100  may be realized by using a circuit corresponding to computer-readable instructions on an FPGA (field-programmable gate array). In addition, the entirety or part of the software development device  100  may be realized by appropriately combining the processor  102 , a main memory, an ASIC, an FPGA, and the like. 
     The software development device  100  may further include a component for reading the stored program or the like from the non-transitory media that stores the software development program  114  including computer-readable instructions. The media may be, for example, an optical medium, such as a DVD (Digital Versatile Disc), or a semiconductor medium, such as a USB memory. 
     In addition, the software development program  114  may not only be installed on the software development device  100  through the media, but also be provided from a distribution server on the network. 
     (b2: Controller  200 ) 
     The controller  200  may be realized by using a general-purpose computer, or may be realized by using a semiconductor substrate including components necessary for realizing processing. 
       FIG. 3  is a schematic diagram showing a hardware configuration example of the controller  200  according to the present embodiment. Referring to  FIG. 3 , the controller  200  includes, as main components, an arithmetic processing unit  210 , a wireless communication module  212 , a USB controller  214 , a communication controller  216 , and an IO driver  218  electrically connected to one or more pads  220 . 
     The arithmetic processing unit  210  is a calculation unit that executes a program, and includes a processor  202 , a main memory  204 , and a flash memory  206  as main components. The processor  202  is, for example, a CPU or a GPU. A plurality of processors  202  may be disposed, or the processor  202  having a plurality of cores may be adopted. The main memory  204  is a volatile storage device, such as a DRAM or an SRAM. The flash memory  206  is a non-volatile storage device that holds a program executed by the processor  202  or necessary data. Among the programs stored in the flash memory  206 , a designated program is loaded to the main memory  204  and executed by the processor  202  to realize various functions. 
     The wireless communication module  212  is in charge of wireless data exchange with any other device. 
     The wireless communication module  212  may include processing circuits and antennas for wireless communication with devices, routers, mobile base stations, and the like. The wireless communication supported by the wireless communication module  212  may be any of Wi-Fi (registered trademark), Bluetooth (registered trademark), ZigBee (registered trademark), LPWA (Low Power Wide Area), GSM (registered trademark), W-CDMA, CDMA200, LTE (Long Term Evolution), and 5th generation mobile communication system (5G), for example. 
     The USB controller  214  is in charge of data exchange with the software development device  100 . The communication controller  216  is in charge of wired data exchange with any other device. The communication controller  216  may be compatible with known data exchange methods, such as serial communication, parallel communication, and GPIO (General-purpose input/output). 
     The IO driver  218  is in charge of transmitting and receiving electrical signals to and from an arbitrary device electrically connected through the pad  220 . The IO driver  218  outputs an electrical signal according to a command from the arithmetic processing unit  210 . In addition, the IO driver  218  detects an electrical signal given through the pad  220  and outputs the detection result to the arithmetic processing unit  210 . More specifically, the IO driver  218  is configured to include a signal generation circuit, a signal detection circuit, a buffer circuit, and the like. 
     The controller  200  may be driven by electric power from a battery (not shown). 
     C. RESTRICTIONS 
     Next, restrictions that can be set by the software development device  100  according to the present embodiment will be described. 
     In this specification, “restrictions” include rules to be complied with in the execution of the object code  116  (assembler code) generated from the source code  112 . The “restrictions” may include restrictions or rules on the resources used by the object code  116  at the time of execution, restrictions or rules on the execution state of the object code  116 , restrictions or rules on the execution procedure of the object code  116 , and restrictions or rules on instructions included in the source code  112 . 
       FIG. 4  is a diagram for describing restrictions that can be set by the software development device  100  according to the present embodiment. The source code  112  shown in  FIG. 4(A)  is a code example for writing an output value determined by a predefined function fn 1 ( ) to a designated address. 
     More specifically, the source code  112  includes an output value variable definition  1121  and an output value variable definition  1122 . The return value of the function fn 1 ( ) is set as a value of the output value OutValue (instruction  1123 ). Then, the value of the output value OutValue is written to the address “0x1000” (instruction  1124 ). 
     Restrictions can be set by adding a restriction code  1125  to the source code  112  shown in  FIG. 4(A) . In the source code  112  shown in  FIG. 4(B) , a restriction code  1125  for designating an accessible memory range is added. For example, “$allowedAddressRange=0x0000 . . . 0x0FFF” means that only the addresses “0x0000” to “0x0FFF” can be accessed. 
     When such restrictions are set, the instruction  1124  for writing the value of the output value OutValue to the address “0x1000” does not conform to the restrictions. That is, the instruction  1124  cannot be executed. 
     The restriction code  1125  shown in  FIG. 4(B)  is effective for a case where the memory range of “0x0000” to “0x0FFF” is set as a non-secure area and the memory range of “0x1000” to “0x1FFF” is set as a secure area in the controller  200 , for example. 
     As typical methods for prohibiting the execution of instructions that do not conform to restrictions, (1) a method of making a determination in the process of generating the object code  116  from the source code  112  and (2) a method of making a determination when generating the object code  116  are assumed. In the method (1), a function of generating the object code  116 , such as a preprocessor, a compiler, and an optimizer, evaluates conformity to restrictions. On the other hand, in the method (2), in addition to the object code  116  generated from the source code  112 , an object code for evaluating conformity to restrictions (hereinafter, also referred to as an “object code for conformity evaluation”) may be generated. An object code for conformity evaluation  118  may be included as a part of the object code  116 , or may be present independently of the object code  116 . Details of such an implementation example will be described later. 
     Next, the application range (hereinafter, also referred to as “scope”) of the restrictions according to the present embodiment will be described. 
     As shown in  FIG. 4(B) , basically, restrictions defined by the restriction code  1125  are applied to a portion following the description of the restriction code  1125 . That is, the portion following the description of the restriction code  1125  is the scope of restrictions. The end position of the scope of restrictions can be set arbitrarily, but basically, the scope of restrictions can be the range of parentheses including the restriction code  1125 . 
     In addition, when a procedure or function is called, the called procedure or function may also be the scope of restrictions. 
       FIG. 5  is a diagram for describing the scope of restrictions that can be set by the software development device  100  according to the present embodiment. As shown in  FIG. 5 , regarding the instruction  1123  to call the function fn 1 ( ) and set the return value of the function fn 1 ( ) as the output value OutValue, a partial source code  1126  of the called function fn 1 ( ) may also be included in the scope of restrictions. 
     Thus, when a call instruction is included in the scope of restrictions, the software development device  100  also evaluates whether or not an instruction (procedure or function) called by the call instruction also conforms to the restrictions. By sequentially inheriting the scope of such restrictions, it is possible to reliably comply with the restrictions by evaluating conformity to the restrictions even for the source code that defines the procedure or function to be called. 
       FIG. 6  is a diagram for describing a case where conformity to restrictions that can be set by the software development device  100  according to the present embodiment should be determined at the time of execution.  FIG. 6(A)  shows a source code  112  similar to the source code  112  shown in  FIG. 4(B) . In the source code  112  shown in  FIG. 6(A) , the address for writing the output value OutValue is fixed to “0x1000” (instruction  1124 ). By lexically analyzing and syntactically analyzing the source code  112 , it can be evaluated that the source code  112  does not conform to the restrictions. 
     On the other hand, in the source code  112  shown in  FIG. 6(B) , the address for writing the value of the output value OutValue is determined by using an output address initial value IniPtr. Therefore, the address to be written cannot be uniquely determined only by analyzing the source code  112 . 
     More specifically, in the source code  112  shown in  FIG. 6(B) , in addition to the definition  1127  of the output address initial value variable, a process  1128  for determining the output address initial value IniPtr is defined. Then, an instruction  1129  to determine an output address, which defines that the output address OutAddrs is determined by adding “0F00” to the output address initial value IniPtr, is defined in the source code  112 . Then, the value of the output value OutValue is written to the address indicated by the output address OutAddrs (instruction  1130 ). 
     In the source code  112  shown in  FIG. 6(B) , the value of the output address OutAddrs depends on the value of the output address initial value IniPtr, and is dynamically determined when the corresponding object code  116  is executed. 
     The software development device  100  according to the present embodiment provides a mechanism capable of evaluating conformity to restrictions even during the execution of the corresponding object code  116  (details will be described later). 
     D. RESTRICTION TYPE 
     As the restrictions according to the present embodiment, the following types may be adopted. 
     
       
         
           
               
               
               
               
             
               
                 TABLE 1 
               
               
                   
               
               
                 No 
                 Restriction code 
                 Set value 
                 Description 
               
               
                   
               
             
            
               
                   
               
            
           
           
               
               
               
               
            
               
                 1 
                 $allowedAddressRange 
                 0x0000 . . . 0xFFFF 
                 Designate accessible memory range 
               
               
                 2 
                 $allowedScopeDepth 
                 usize 
                 Designate depth with effective scope 
               
               
                   
                   
                 (default: none) 
                 $allowSelfRecursion is set to False 
               
               
                 3 
                 $allowedStackDepth 
                 usize 
                 Designate depth of stack with effective scope 
               
               
                   
                   
                 (default: none) 
                 $allowSelfRecursion is set to False 
               
               
                 4 
                 $enableRuntimeSafety 
                 True | False 
                 Enable/disable runtime security execution 
               
               
                   
                   
                 (default: True) 
               
               
                 5 
                 $enforceStrictSwitches 
                 True | False 
                 Force/unforce all option designations in ( ) statement 
               
               
                   
                   
                 (default: True) 
               
               
                 6 
                 $allowPanics 
                 True | False 
                 Allow/disallow panic occurrence 
               
               
                   
                   
                 (default: False) 
               
               
                 7 
                 $allowUndefinedVariables 
                 True | False 
                 Availability of undefined variables 
               
               
                   
                   
                 (default: False) 
               
               
                 8 
                 $allowUnreachable 
                 True | False 
                 Allow/disallow state of unreachable to designated destination 
               
               
                   
                   
                 (default: False) 
               
               
                 9 
                 $allowNoReturns 
                 True | False 
                 Allow/disallow state in which return value cannot be obtained 
               
               
                   
                   
                 (default: False) 
               
               
                 10 
                 $clearMemoryUponEnd 
                 True | False 
                 Whether or not to completely clear memory at the end of scope 
               
               
                   
                   
                 (default: false) 
               
               
                 11 
                 $allowInputToOutput 
                 True | False 
                 Allow/disallow return from scope of designated memory 
               
               
                   
                   
                 (default: True) 
               
               
                 12 
                 $allowConditionalBranches 
                 True | False 
                 Availability of conditional branches 
               
               
                   
                   
                 (default: True) 
               
               
                 13 
                 $allowSelfRecursion 
                 True | False 
                 Availability of recursive call 
               
               
                   
                   
                 (default: True) 
               
               
                 14 
                 $allowPtrToZero 
                 True | False 
                 Availability of pointer indicating 0x0 
               
               
                   
                   
                 (default: False) 
               
               
                 15 
                 $allowRawPointers 
                 True | False 
                 Availability of pointer indicating physical value 
               
               
                   
                   
                 (default: False) 
               
               
                 16 
                 $inlineFunctionCalls 
                 True | False 
                 Force/unforce inline deployment of all functions called 
               
               
                   
                   
                 (default: False) 
               
               
                 17 
                 $floatMode= 
                 Strict/Optimized 
                 Strict: execute floating-point operations in accordance with IEEE compliance 
               
               
                   
                 @import(“builtin”).FloatMode 
                 (default:. Strict) 
                 Optimized: optimization for high-speed mathematical processing 
               
               
                 18 
                 $evalBranchQuota 
                 Usize 
                 Backward-possible maximum number 
               
               
                   
                   
                 (default: 1000) 
               
               
                 19 
                 $allowSubWithOverflow 
                 True | False 
                 Allow/disallow subtraction processing with overflow 
               
               
                   
                   
                 (default: True) 
               
               
                 20 
                 $allowMulWithOverflow 
                 True | False 
                 Allow/disallow multiplication processing with overflow 
               
               
                   
                   
                 (default: True) 
               
               
                 21 
                 $allowRem 
                 True | False 
                 Allow/disallow surplus processing 
               
               
                   
                   
                 (default: True) 
               
               
                 22 
                 $allowPtrCast 
                 True | False 
                 Allow/disallow type conversion processing 
               
               
                   
                   
                 (default: True) 
               
               
                 23 
                 $allowMemset 
                 True | False 
                 Allow/disallow memory block settings 
               
               
                   
                   
                 (default: True) 
               
               
                   
               
            
           
         
       
     
     
       
         
           
               
               
               
               
             
               
                 TABLE 2 
               
               
                   
               
               
                 No 
                 Restriction code 
                 Set value 
                 Description 
               
               
                   
               
             
            
               
                 24 
                 $allowIntToPtr 
                 True | False 
                 Allow/disallow integer settings for pointer 
               
               
                   
                   
                 (default: True) 
               
               
                 25 
                 $allowBreakpoint 
                 True | False 
                 Allow/disallow use of breakpoints 
               
               
                   
                   
                 (default: True) 
               
               
                 26 
                 $allowBitCas 
                 True | False 
                 Allow/disallow bitcast operators 
               
               
                   
                   
                 (default: True) 
               
               
                 27 
                 $allowExternalCalls 
                 True | False 
                 Allow/disallow calls from external functions 
               
               
                   
                   
                 (default: True) 
               
               
                 28 
                 $allowExternalVariables 
                 True | False 
                 Allow/disallow external variables 
               
               
                   
                   
                 (default: True) 
               
               
                 29 
                 $allowVarArgs 
                 True | False 
                 Allow/disallow use to parameterize variables 
               
               
                   
                   
                 (default: True) 
               
               
                 30 
                 $allowErrorTermination 
                 True | False 
                 Allow/disallow error stream caused by scope 
               
               
                   
                   
                 (default: True) 
               
               
                 31 
                 $allowGlobalVariables 
                 True | False 
                 Allow/disallow use of global variables 
               
               
                   
                   
                 (default: True) 
               
               
                 32 
                 $allowGlobalConstants 
                 True | False 
                 Allow/disallow use of global constants 
               
               
                   
                   
                 (default: True) 
               
               
                 33 
                 $allowIntermediateVariables 
                 True | False 
                 Allow/disallow use of intermediate variables/intermediate constants 
               
               
                   
                   
                 (default: True) 
                 * Intermediate variable/intermediate constant refers to a set of 
               
               
                   
                   
                   
                 structures and enumeration types used in the 
               
               
                 34 
                 $allowIntermediateConstants 
                 True | False 
                 preceding and subsequent global scopes 
               
               
                   
                   
                 (default: True) 
               
               
                 35 
                 $allowSuperVariables 
                 True | False 
                 Allow/disallow use of hypervariables/hyperconstants 
               
               
                   
                   
                 (default: True) 
                 * Hypervariable/hyperconstant refers to a set of structures and 
               
               
                   
                   
                   
                 enumeration types used only in the current scope 
               
               
                 36 
                 $allowSuperConstants 
                 True | False 
               
               
                   
                   
                 (default: True) 
               
               
                 37 
                 $allowLocalVariables 
                 True | False 
                 Allow/disallow use of local variables 
               
               
                   
                   
                 (default: True) 
               
               
                 38 
                 $allowLocalConstants 
                 True | False 
                 Allow/disallow use of local constants 
               
               
                   
                   
                 (default: True) 
               
               
                 39 
                 $allowThreadLocalVariables 
                 True | False 
                 Allow/disallow use of thread for local variables 
               
               
                   
                   
                 (default: True) 
               
               
                 40 
                 $allowInlineAssembly 
                 True | False 
                 Applicability of inline-deployed assembly to scope 
               
               
                   
                   
                 (default: True) 
               
               
                 41 
                 $coldScope 
                 True | False 
                 Whether or not to notify the optimizer that the scope execution 
               
               
                   
                   
                 (default: False) 
                 frequency is low 
               
               
                 42 
                 $secureScope 
                 True | False 
                 Being set to True means the followings 
               
               
                   
                   
                   
                 Set $allowInputToOutput to False 
               
               
                   
                   
                   
                 Set $clearMemoryOnExit to True 
               
               
                   
                   
                   
                 Set $allowConditionalBranches to False 
               
               
                   
                   
                   
                 Set $enableRuntimeSafety to True 
               
               
                   
                   
                   
                 Set $allowUnreachablePaths to False 
               
               
                   
                   
                   
                 Set $allowUndefinedVariables to False 
               
               
                   
                   
                   
                 Set $allowPanics to False 
               
               
                   
                   
                   
                 Set $allowFunctionRecursion to False 
               
               
                   
                   
                   
                 Set $floatMode to Strict 
               
               
                   
                   
                   
                 Set $allowErrorTermination to False 
               
               
                   
               
            
           
         
       
     
     The restrictions described above typically include restrictions or rules on the resources used by the object code  116  at the time of execution, restrictions or rules on the execution state of the object code  116 , restrictions or rules on the execution procedure of the object code  116 , and restrictions or rules on instructions included in the source code  112 . 
     In addition, it is not necessary to implement all of the restriction codes shown in the above tables, and only some of the restriction codes may be implemented according to the required specifications. In addition, restriction codes other than the restriction codes shown in the above tables may be adopted. 
     E. MECHANISM FOR EVALUATING CONFORMITY TO RESTRICTIONS 
     Next, an example of a mechanism in which the software development device  100  according to the present embodiment evaluates conformity to restrictions will be described. 
       FIG. 7  is a block diagram showing a functional configuration provided by the software development device  100  according to the present embodiment. Each function shown in  FIG. 7  is typically realized when the processor  102  of the software development device  100  executes the software development program  114 . 
     Referring to  FIG. 7 , the software development program  114  receives an input of the source code  112  and generates the object code  116  (assembler code). More specifically, the software development program  114  includes a preprocessor  1141 , a compiler  1142 , an optimizer  1143 , and a code generator  1144 . 
     The preprocessor  1141  performs lexical analysis and syntactic analysis on the source code  112 , and controls the operations of the compiler  1142 , the optimizer  1143 , and the code generator  1144 . 
     The compiler  1142  generates an object code based on the results of lexical analysis and syntactic analysis on the source code  112 . The optimizer  1143  optimizes the generated object code. The code generator  1144  outputs the final object code  116  based on the result of optimization by the optimizer  1143 . 
     When evaluating conformity to the above-described restrictions, the preprocessor  1141 , the compiler  1142 , and the optimizer  1143  extract restrictions defined in the source code  112  and evaluate conformity to the extracted restrictions (step S 1 ). In addition, the optimizer  1143  may modify the object code according to the content of the set restrictions. In this manner, the software development device  100  extracts the restrictions set in the source code  112 , and evaluates whether or not the source code  112  conforms to the restrictions within the scope of the extracted restrictions. 
     When conformity to the extracted restrictions can be evaluated only at the time of executing the object code  116 , the code generator  1144  generates the object code for conformity evaluation  118  that is an assembler code for evaluating conformity to restrictions (step S 2 ). 
     In this manner, the software development device  100  generates the object code  116  so as to conform to the restrictions. 
       FIG. 8  is a diagram for describing a method of realizing conformity to restrictions on a call in the software development device  100  according to the present embodiment. The process shown in  FIG. 8  may be provided by the software development program  114 , or may be provided by the object code for conformity evaluation  118  when the object code  116  is executed. 
     Referring to  FIG. 8 , a dataset  150  indicating a restriction scope (hereinafter, also referred to as a “parent scope”) set in the procedure of a caller is generated. The dataset  150  of the parent scope includes information such as variables, restrictions, and procedures. A management object  152  is also generated in association with the dataset  150  of the parent scope. 
     A dataset  154  indicating a restriction scope (hereinafter also referred to as a “child scope”) to be inherited by the procedure of a callee is associated with the dataset  150  of the parent scope. A management object  156  is also generated in association with the dataset  154  of the child scope. 
     For example, when a procedure or a function is called, the management object  152  associated with the dataset  150  of the parent scope is referred to (step S 11 ). Then, the dataset  154  of the child scope is generated based on the dataset  150  of the parent scope (step S 12 ). In response to a reference (step S 13 ) from the dataset  154  of the child scope to the management object  152 , the management object  156  is generated from the management object  152  (step S 14 ). The generated management object  156  is associated with the dataset  154  of the child scope (step S 15 ). 
     By repeating such a series of processing, the scope of the set restrictions is inherited when the procedure or the function is called. 
     F. PROCESSING PROCEDURE 
     Next, a processing procedure for generating an object code from a source code in the software development device  100  according to the present embodiment will be described. 
       FIG. 9  is a flowchart showing a processing procedure for generating an object code from a source code in the software development device  100  according to the present embodiment. Each step shown in  FIG. 9  is typically realized when the processor  102  executes the software development program  114 . 
     Referring to  FIG. 9 , the software development device  100  performs lexical analysis and syntactic analysis on the input source code  112  (step S 100 ). The software development device  100  determines whether or not restrictions are set based on the analysis results (step S 102 ). That is, the software development device  100  extracts the restrictions set in the source code  112 , and evaluates whether or not the source code  112  conforms to the restrictions within the scope of the extracted restrictions. Here, if restrictions are not set (NO in step S 102 ), the intermediate steps are skipped, and the processing from step S 118  is executed. 
     If restrictions are set (YES in step S 102 ), the software development device  100  selects one of the set restrictions (step S 104 ), and determines whether or not the source code included in the scope of the selected restriction conforms to the restriction (step S 106 ). 
     If there is a portion of the source code included in the scope of the selected restriction that does not conform to the restriction (NO in step S 106 ), the software development device  100  outputs a message indicating “not conform to restriction” (step S 108 ), and the process of generating the object code  116  is interrupted (step S 110 ). Then, the process ends. As described above, the software development device  100  stops the generation of the object code  116  when it is evaluated that the source code  112  does not conform to the restriction within the scope of the restriction. 
       FIG. 10  is a diagram showing an example of a user interface screen provided by the software development device  100  according to the present embodiment. Referring to  FIG. 10 , a user interface screen  300  includes an edit area  302  for creating a source code, a compile button  304  for starting the compilation of the source code created in the edit area  302 , and a message display area  306  for displaying an error message. A message indicating “not conform to restrictions” may be displayed in the message display area  306 . 
     Referring back to  FIG. 9 , if it cannot be determined whether or not the source code included in the scope of the selected restriction conforms to the restriction (“unknown” in step S 106 ), the software development device  100  marks a portion where it cannot be determined whether or not the source code conforms to the restriction (step S 112 ). Then, the process proceeds to step S 114 . 
     If all of the source codes included in the scope of the selected restriction conforms to the restriction (YES in step S 106 ), the software development device  100  determines whether or not the evaluation for all of the set restrictions has been completed (step S 114 ). If some of the set restrictions have not been evaluated (NO in step S 114 ), the software development device  100  selects one of the unevaluated restrictions (step S 116 ), and executes the processing from step S 106 . 
     If the evaluation for all of the set restrictions has been completed (YES in step S 114 ), the software development device  100  generates the object code  116  (step S 118 ). 
     Subsequently, the software development device  100  determines whether or not a portion where it cannot be determined whether or not the source code conforms to the restriction is marked (step S 120 ). That is, it is determined whether or not any portion is marked in step S 112  described above. 
     If a portion where it cannot be determined whether or not the source code conforms to the restriction is not marked (NO in step S 120 ), the processing of step S 122  is skipped. On the other hand, if a portion where it cannot be determined whether or not the source code conforms to the restriction is marked (YES in step S 120 ), the software development device  100  generates the object code for conformity evaluation  118  for determining whether or not the marked portion conforms to the restriction set at the time of execution (step S 122 ). As described above, when it is not possible to evaluate whether or not the source code  112  conforms to the restriction within the scope of the restriction, the software development device  100  generates another object code (object code for conformity evaluation  118 ) for evaluating whether or not the source code  112  conforms to the restriction during the execution of the object code  116  in addition to the object code  116  corresponding to the source code  112 . 
     Finally, the software development device  100  outputs the generated object code (step S 124 ). That is, the software development device  100  generates the object code so as to conform to the restrictions included in the source code  112 . Then, the process ends. 
     G. MODIFICATION EXAMPLE 
     In the above description, for convenience of explanation, a case where one restriction is set has been illustrated, but a plurality of restrictions may be set in an overlapping manner without being limited thereto. In addition, a plurality of restrictions may be set so that their scopes partially overlap each other. 
     In addition, in the above description, a configuration example in which a restriction code is embedded in the source code  112  has been illustrated, but a definition file that defines restrictions may be prepared separately from the source code  112  without being limited thereto. In this case, the definition file may include information specifying a procedure name or a function name that is the scope of restrictions in association with the content of restrictions to be applied. 
     As described above, any method can be adopted as a restriction setting method. 
     H. ADVANTAGES 
     According to the software development device  100  according to the present embodiment, it is possible to provide an environment in which various restrictions can be freely set for a program executed by an edge device or the like. As a result, it is possible to create a program executed by an edge device, taking into consideration various points in terms of available resources and security. 
     It should be considered that the embodiment disclosed is an example in all points and not restrictive. The scope of the present invention is defined by the claims rather than the above description, and is intended to include all modifications within the scope and meaning equivalent to the claims. 
     EXPLANATIONS OF LETTERS OR NUMERALS 
     
         
         
           
               1  IoT SYSTEM 
               2  EDGE DEVICE 
               100  SOFTWARE DEVELOPMENT DEVICE 
               102 ,  202  PROCESSOR 
               104 ,  204  MAIN MEMORY 
               106  INPUT UNIT 
               108  DISPLAY 
               110  HARD DISK 
               112  SOURCE CODE 
               114  SOFTWARE DEVELOPMENT PROGRAM 
               116  OBJECT CODE 
               118  OBJECT CODE FOR CONFORMITY EVALUATION 
               120  INTERNAL BUS 
               122  COMMUNICATION INTERFACE 
               150 ,  154  DATASET 
               152 ,  156  MANAGEMENT OBJECT 
               200  CONTROLLER 
               206  FLASH MEMORY 
               210  ARITHMETIC PROCESSING UNIT 
               212  WIRELESS COMMUNICATION MODULE 
               214  USB CONTROLLER 
               216  COMMUNICATION CONTROLLER 
               218  DRIVER 
               220  PAD 
               300  USER INTERFACE SCREEN 
               302  EDIT AREA 
               304  COMPILE BUTTON 
               306  MESSAGE DISPLAY AREA 
               1121 ,  1127  DEFINITION 
               1123 ,  1124 ,  1129 ,  1130  INSTRUCTION 
               1125  RESTRICTION CODE 
               1126  PARTIAL SOURCE CODE 
               1128  PROCESSING 
               1141  PREPROCESSOR 
               1142  COMPILER 
               1143  OPTIMIZER 
               1144  CODE GENERATOR