⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makehelp.txt

📁 picoos源码。The RTOS and the TCP/IP stack will be built automatically.
💻 TXT
📖 第 1 页 / 共 2 页
字号:
to your main program to the variable @c MODULES in line 73. You do not need
to set also the library name in line 47, this does the pico]OS make for you. @n



To build your application, simply invoke make with the target @c all to
generate the executable. The makefile supports also the target @c clean
that cleans your last build again. Note: If you do not have set the @c PORT
and the @c BUILD mode in the makefile, you need to specify them on the
make command line. In this case, a valid make call would look like this:
<code> " make all PORT=x86w32 BUILD=DEBUG " </code> @n






@n             <h3> Building A Library or Module </h3>

As described above, sometimes it is useful (or maybe necessary) to divide
a project into some smaller modules or so called libraries. For this purpose
pico]OS provides an example makefile (see examples directory,
file @c library.mak) that looks like this:

@code
01 # ---------------------------------------------------------------------------
02 # PRECONDITION SETUP
03 # ---------------------------------------------------------------------------
04
05 # Set relative path to the picoos root directory  -> YOU NEED TO CHANGE THIS!
06 RELROOT = ../../../picoos/
07
08 # Get pico]OS path from environment (if it is set)
09 ifneq '$(strip $(PICOOS))' ''
10 RELROOT := $(PICOOS)/
11 endif
12
13 # Include common makefile
14 include $(RELROOT)make/common.mak
15
16
17
18 # ---------------------------------------------------------------------------
19 # LIBRARY SETTINGS
20 # ---------------------------------------------------------------------------
21
22 # Set target file name (library filename without extension)
23 TARGET =
24
25
26 ### Set up lists of source files ###
27
28 # Set list of C source files / assembler files
29 SRC_TXT =
30
31 # Set list of header files used by the C source files
32 SRC_HDR = 
33
34 # You may add some already compiled object files here
35 SRC_OBJ =
36
37
38 # Set additional C-defines
39 CDEFINES +=
40
41 # Set additional include paths
42 DIR_USRINC +=
43
44 # Set the output directory for the generated binaries. If you do not
45 # set this variable, the files will be stored in the pico]OS root
46 # root directory structure (pioos/out, picoos/lib, picoos/obj)
47 # Note: Please keep the ifeq/endif pair. This allows to set the
48 # output directory from outsite (may be by a project makefile).
49 ifeq '$(strip $(DIR_OUTPUT))' ''
50 DIR_OUTPUT = $(CURRENTDIR)/bin
51 endif
52
53
54
55 # ---------------------------------------------------------------------------
56 # BUILD THE LIBRARY
57 # ---------------------------------------------------------------------------
58
59 include $(MAKE_LIB)
60
@endcode

Like above, the lines 6, 14, 23, 29 and 59 are mandatory.
@c RELROOT sets the relative way to the pico]OS root directory.
Line 14 includes the main makefile of the make environment.
Line 23 sets the name of the generated library. Note that only the
basename must be specified, the file extension is added automatically.
Lines 28 to 35 set the source files that shall be added to the library.
@c SRC_TXT specifies a list of sourcecode files (in textual form), and
@c SRC_HDR is set to a list of C header files that are referenced
by the C source files. The variable @c SRC_OBJ can be filled with some
precompiled object files (but this feature you won't really use).
In line 39 you can set preprocessor defines to control the compilation
of your software. The defines are passed to the compiler and can be checked
with the #if / #endif preprocessor command in the C source files.
Additional include paths for header files can be set in line 42. Please
use the preprocessor command @c #include @c <header.h> to include a header
file that is located in the global include path.
In line 50 you may specify your own output directory for the generated
binaries. If you do not set this variable, the binaries will be saved in
the directory <tt>picoos-1.0.0/out/portname/rel_or_deb/</tt>.
Finally, the line 59 includes the makefile that starts the
build process. @n@n
To generate the library manually, you can call the makefile with the
port and build mode parameter: 
<code> " make all PORT=x86w32 BUILD=DEBUG " </code>. As an option, you
may also set the NANO flag to 1 (@c NANO=1) if the library uses the
nano layer of pico]OS. @n@n
But in most cases you will start the makefile from within a main makefile
that is used to compile the whole project. Take the file @c outfile.mak
from the examples directory as a template for such a main makefile. When
you add this library makefile (that means, the name and path of the directory
where this library makefile is located) to the @c MODULES= variable in the
main makefile, the library makefile will be automatically executed when
the project is built. All command line parameters that are set to execute
the main makefile will also be passed to the library makefiles.@n@n






@n               <h3> Format Of File port.mak </h3>

Each platform port need to have a special version of the file port.mak.
This file is used to tell the make environment the settings needed to
compile files for the platform. This settings include: The compiler /
linker / archiver to use, runtime libraries to link to the exectuable,
file extension names, and various port specific settings.
Here is an example how the file <tt>port.mak</tt> may look like: @n


@code

01  #
02  # port.mak for the 6502 port
03  #
04  
05  # Compiler: Define place of compiler
06  CC65 = h:/cc65
07  
08  # Compiler: Define target type
09  TG = c64
10  
11  # Set to 1 to include generic pico]OS "findbit" function
12  GENERIC_FINDBIT = 0
13  
14  # Define extensions
15  EXT_C   = .c
16  EXT_ASM = .s
17  EXT_OBJ = .o
18  EXT_LIB = .lib
19  EXT_OUT = .$(TG)
20  
21  # Define tools: compiler, assembler, archiver, linker
22  CC = $(CC65)/bin/cc65
23  AS = $(CC65)/bin/ca65
24  AR = $(CC65)/bin/ar65
25  LD = $(CC65)/bin/ld65
26  
27  # Define to 1 if CC outputs an assembly file
28  CC2ASM = 1
29  
30  # Define general options
31  OPT_CC_INC   = -I
32  OPT_CC_DEF   = -D
33  OPT_AS_INC   = -I
34  OPT_AS_DEF   = -D
35  OPT_AR_ADD   =
36  OPT_LD_SEP   = 
37  OPT_LD_PFOBJ = 
38  OPT_LD_PFLIB = 
39  OPT_LD_FIRST = $(CC65)/lib/$(TG).o
40  OPT_LD_LAST  = $(CC65)/lib/$(TG).lib
41  
42  # Set global defines for compiler / assembler
43  CDEFINES =
44  ADEFINES =
45  
46  # Set global includes
47  CINCLUDES = $(CC65)\include .
48  AINCLUDES = $(CC65)\include .
49  
50  # Distinguish between build modes
51  ifeq '$(BUILD)' 'DEBUG'
52    CFLAGS   += -g
53    AFLAGS   += -g
54    CDEFINES += _DBG
55    ADEFINES += _DBG
56  else
57    CDEFINES += _REL
58    ADEFINES += _REL
59  endif
60  
61  # Define Compiler Flags
62  CFLAGS += -t $(TG) -O -A -T -o 
63  
64  # Define Assembler Flags
65  ASFLAGS += -t $(TG) -o 
66  
67  # Define Linker Flags
68  LDFLAGS = -t $(TG) -Ln $(DIR_OUT)/$(TARGET).lbl -m $(DIR_OUT)/$(TARGET).map -o 
69  
70  # Define archiver flags
71  ARFLAGS = a 

@endcode

The lines 12, 15 - 19, 22 - 25, 28, 31 - 40, 54 - 55, 57 - 58, 62, 65, 68
and 71 are mandatory.
If @c GENERIC_FINDBIT (line 12) is enabled (= set to 1), the file fbit_gen.c
is compiled and linked to the pico]OS library. Some compilers need a special
handling to compile C-files. If @c CC2ASM is set to 1, the make system will
first generate assembly files from C source files before generating the
final object file from the intermediate assembly file.


*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -