SDCCã¯Small Device C Compilerã®é æåããšã£ãŠããåŒã°ããŠãããååã®éããªãœãŒã¹ã®å°ããªãã·ã³ã§äœ¿ãããã®Cã³ã³ãã€ã©ã®ããšãæããŸãããããªãã°çµã¿èŸŒã¿éçºã§äœ¿ãã³ã³ãã€ã©ã®ããšãæããŸãã
ã³ãã³ãã©ã€ã³ããŒã¹ã§ã³ã³ãã€ã«ãã§ãããã®ã«ãªããŸãããè¿ä»£ã®éçºã¯ãã¯ããã ã®ã³ã³ãã€ã©ã ãã§ã¯ãªããIDEãªã©ã®çµ±åéçºç°å¢ãããããšãåœç¶ã§ãšãã£ã¿ããããªããã®ããã£ãŠåœç¶ã®æ代ã«ãªããŸããã
調ã¹ãŠã¿ããšæå€ãšSDCCãã¹ã ãŒãºã«äœ¿ããããã«ãªããŸã§ã®æé ãããŸããŠã§ãã«æžãããŠããªãæ°ãããã®ã§ãèªåã§è©Šè¡é¯èª€ããªããéçºç°å¢ãäœã£ãŠã¿ãããšæã£ã話ã§ãããšãããèªåãå¿ããã®ã§ãã ã®åå¿é²ã§ãã
ä»åç§ã䜿ããããã®ã¯PADAUKãšããã¡ãŒã«ã§ããæ¬æ¥ã¯å°çšã®èšèªã䜿ã£ãŠéçºãããã®ãªã®ã§ãããSDCCã§ã³ã³ãã€ã«ã§ããããã«ããŠãããå 人ãããã®ã§ãã®éçºç°å¢ãäœã£ãŠã¿ãããšæããŸãããããããã®çšåºŠã ãšãããã¬ã¯å³ããæ°ãããã®ã§ã³ãŒããšãã£ã¿ããã³ã³ãã€ã«ãã§ãããããªç°å¢ãäœããšãããç®æšã«ããŸãã
çµæçã«SDCCèªäœã¯Windowsç°å¢ã§ã€ã³ã¹ããŒã«ã§ããã®ã§ãããPADAUKã®ãã€ã³ã³ã®OSSããŒã«ãã§ãŒã³ãããŸãåãããªãã£ãã®ã§ãä»åã¯WSLã䜿ã£ãŠèœã¡çããŸããããããããæ®éã«SDCCã䜿ãã ããªãWindowsã®æ¹ã§å€§äžå€«ã ãšæããŸãããç¹æ®ãªç°å¢ã ã£ããã§ãããªã£ããšããæãã§ãã
WSL2ãå©çšãã
çµè«ãšãããè©Šè¡é¯èª€ããŠããããããªããšãããšããã§WIndowsç°å¢ããçŽæ¥ã³ã³ãã€ã«ããã®ã¯è«ŠããŸãããæåŸã«è©Šè¡é¯èª€ã®çµæã¯èŒããŠããŸãããçµå±ã¯ããŸãè¡ããŸããã
ãšããããã§WSLã«éããŸãããšããããã§WLSãã€ã³ã¹ããŒã«ããŸãã现ãã説æã¯ã»ãã®ãµã€ãã®æ¹ã詳ããã®ã§ããã§ã¯éã«èª¬æããŠãããŸãã管çè ã§ã³ãã³ãããã³ãããå®è¡ããŸãã
wsl --install
å šãŠçµãããšåèµ·åãä¿ãããã®ã§åèµ·åããŸããåèµ·åãçµãããšåã³WLSã®ã€ã³ã¹ããŒã«äœæ¥ãå§ãŸãã®ã§ãã°ããæŸçœ®ããŸããçµãã£ããWindowsã®ã¡ãã¥ãŒãéããŸãããããšUbuuntuãå¢ããŠããã®ã§ãããèµ·åããããšãŠãŒã¶ãŒã®äœæãåºãŠããã®ã§æ瀺ã«åŸã£ãŠäœæããŸãã
ããããã¯ããæ®éã®Linuxç°å¢ã®äœæã«ãªããŸãããŸãã¯aptãæŽæ°ããŠã¢ããããŒãããŸãã
sudo apt-get update
sudo apt-get upgrade
ãã®ã€ã³ã¹ããŒã«ãããUbuntuã¯æå°ã®æ§æã®ãããªã®ã§gccãšããå ¥ã£ãŠããªããããªã®ã§è²ã å ¥ããŠãããŸãã
sudo apt-get install build-essential git gzip2 bison gputils flex texinfo libboost-all-dev gpasm
ãã«ãç°å¢ãæŽããã次ã¯SDCCããã«ãããŠãããŸãããŸãã¯SDCCã®å ¬åŒãµã€ãã«ã¢ã¯ã»ã¹ããŠsnapshotããææ°ã®ãœãŒã¹ã³ãŒããæŸã£ãŠããŸãããããã以äžã®ã³ãã³ãã§è§£åããŸãã
tar xvjf xxxx.tar.bz2
解åããããã«ããã©ã«ãã«ç§»åããŠãã«ãã«ç§»ããŸãã
cd sdcc
./configure
configureã®æ®µéã§äœã足ããªããšåºããããã±ãŒãžãäžè¶³ããŠããã®ã§å¿ èŠã§ããã°è¿œå ããŸãã
ãããçµãã£ããé·ããã«ãã¿ã€ã ã§ããã³ã³ãã€ã©ã®ãã«ãã¯åºæ¬çã«æéãããããã®ãªã®ã§æ°é·ã«åŸ ã¡ãŸããj12ãšããŠããã®ã¯èªåã®PCã®éœåãªã®ã§ãnprocã§å šåã§ãã«ããããªã奜ãã«ããŠãã ããã
make -j12
å šãŠãã«ããçµãã£ããã€ã³ã¹ããŒã«ããŸãã
$sudo make install
$sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8 TD- 4.5.2 #15366 (Linux)
published under GNU General Public License (GPL)
ãããªæãã§è¡šç€ºãããã°sdccã®ã€ã³ã¹ããŒã«ãã§ããŠããŸãã
次ã«èªåã®å Žåã¯PADAUKã®ãµã³ãã«ã³ãŒãããã«ãããŠã¿ãŸãã
git clone https://github.com/free-pdk/free-pdk-examples.git
cd free-pdk-examples/BlinkLED
makeããŠä»¥äžã®ããã«è¡šç€ºããããåé¡ãªããã«ãã§ããŠããŸãã
$ make
sdcc -mpdk14 -c --std-sdcc11 --opt-code-size -DPFS154 -DF_CPU=1000000 -DTARGET_VDD_MV=4000 -I. -I../include -o .build/main.rel main.c
main.c:21: warning 283: function declarator with no prototype
sdcc -mpdk14 --out-fmt-ihx -o .output/BlinkLED_PFS154.ihx .build/main.rel
makebin -p .output/BlinkLED_PFS154.ihx .output/BlinkLED_PFS154.bin
---------- Segments ----------
. .ABS. 00000000 00000000 = 0. bytes (ABS,CON)
. .ABS. 00000000 00000000 = 0. bytes (ABS,CON)
HEADER1 00000000 00000002 = 2. bytes (ABS,CON)
HEADER3 00000000 00000014 = 20. bytes (ABS,CON)
PREG2 00000000 00000002 = 2. bytes (ABS,CON)
RSEG0 00000000 00000002 = 2. bytes (ABS,CON)
SSEG 00000006 00000001 = 1. bytes (REL,CON)
HOME 00000022 00000002 = 2. bytes (REL,CON)
GSINIT 00000024 00000014 = 20. bytes (REL,CON)
GSFINAL 00000038 00000002 = 2. bytes (REL,CON)
CODE 0000003A 00000074 = 116. bytes (REL,CON)
------------------------------
Size of BlinkLED_PFS154.bin: 174 bytes
ãã«ãã§ããããšã¯ç¢ºèªã§ãããã©ãã¡ã€ã«ã®å®æ ã¯ã©ãã«ããã®ãïŒãšãªããŸãããã³ã³ãã€ã«ãããã¡ã€ã«ã確èªãããšãšãã«ãœãŒã¹ã³ãŒããæ¢ããŠã³ãŒããšãã£ã¿ã§ç·šéãããã¯ããããšãããwslã®ãã¡ã€ã«ã¯ããã©ã«ãã ãšããŒã ãã£ã¬ã¯ããªã以äžã®ããã«èšå®ãããŠããŸãã
\\wsl.localhost\Ubuntu\home\(ãŠãŒã¶ãŒå)
ããããã¯å ã»ã©ãã«ããããã¡ã€ã«ãæ¢ããŠããã ãã§ããããšã¯æ®éã«Windowsã®ãã¡ã€ã«ãšåãããã«æ±ããã®ã§ãã¡ã€ã«ãç ®ããªãçŒããªã奜ãã«ã§ããŸãã
Windowsã§è©Šè¡é¯èª€(倱æ)
ãŸãåãã«ãSDCCãã®ãã®ãå ¥ããŸãã
-SDCCå
¬åŒãµã€ã-
https://sdcc.sourceforge.net
Releaseã®ããŒãžããä»»æã®ããŒãžã§ã³ãªãææ°ã®ãå ¥ããŸããã€ã³ã¹ããŒã©åœ¢åŒã®ãã®ãäœãèããªããŠããã®ã§æ¥œã§ããã
ã€ã³ã¹ããŒã©ã®æ瀺éãã«å ¥ããŠãããæåŸã«Pathã«SDCCãè¿œå ãããå°ããããã®ã§ãè¿œå ããŠãããŸãã
ãã®åŸãWindowsã®ç°å¢å€æ°ã«SDCCã®binã®ãã¹ãè¿œå ãããŠãããã念ã®ãã確èªããŠãããŸãããŸããã³ãã³ãããã³ããäžã§ãSDCCãèªèãããŠãããã確èªããŠã¿ãŸããsdcc --helpãšå ¥ããŠã¿ãŸãã
CMD_Windows> sdcc --help
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8 TD- 4.5.2 #15366 (MINGW64)
published under GNU General Public License (GPL)
Usage : sdcc [options] filename
Options :-
General options:
--help Display this help
-v --version Display sdcc's version
--verbose Trace calls to the preprocessor, assembler, and linker
-V Execute verbosely. Show sub commands as they are run
-d Output list of macro definitions in effect. Use with -E
-D Define macro as in -Dmacro
-I Add to the include (*.h) path, as in -Ipath
-A
-U Undefine macro as in -Umacro
-M Preprocessor option
-W Pass through options to the pre-processor (p), assembler (a) or linker (l)
--include Pre-include a file during pre-processing
-E --preprocessonly Preprocess only, do not compile
--syntax-only Parse and verify syntax only, do not compile
-S Compile only; do not assemble or link
-c --compile-only Compile and assemble, but do not link
--c1mode Act in c1 mode. The standard input is preprocessed code, the output is assembly code.
-o Place the output into the given path resp. file
-x Optional file type override (c, c-header or none), valid until the next -x
--print-search-dirs display the directories in the compiler's search path
--vc messages are compatible with Micro$oft visual studio
--use-stdout send errors to stdout instead of stderr
--nostdlib Do not include the standard library directory in the search path
--nostdinc Do not include the standard include directory in the search path
--less-pedantic Disable some of the more pedantic warnings
--disable-warning <nnnn> Disable specific warning
--Werror Treat the warnings as errors
--debug Enable debugging symbol output
--cyclomatic Display complexity of compiled functions
--std Determine the language standard (c90, c99, c11, c23, c2y, sdcc89 etc.)
--fdollars-in-identifiers Permit '$' as an identifier character
--fsigned-char Make "char" signed by default
--use-non-free Search / include non-free licensed libraries and header files
Code generation options:
-m Set the port to use e.g. -mz80.
-p Select port specific processor e.g. -mpic14 -p16f84
--stack-auto Stack automatic variables
--xstack Use external stack
--int-long-reent Use reentrant calls on the int and long support functions
--float-reent Use reentrant calls on the float support functions
--xram-movc Use movc instead of movx to read xram (xdata)
--callee-saves <func[,func,...]> Cause the called function to save registers instead of the caller
--fomit-frame-pointer Leave out the frame pointer.
--all-callee-saves callee will always save registers used
--stack-probe insert call to function __stack_probe at each function prologue
--no-xinit-opt don't memcpy initialized xram from code
--no-c-code-in-asm don't include c-code as comments in the asm file
--no-peep-comments don't include peephole optimizer comments
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
Optimization options:
--opt-code-speed Optimize for code speed rather than size
--opt-code-size Optimize for code size rather than speed
--max-allocs-per-node Maximum number of register assignments considered at each node of the tree decomposition
--no-reg-params On some ports, disable passing some parameters in registers
--nostdlibcall Disable optimization of calls to standard library
--nooverlay Disable overlaying leaf function auto variables
--nogcse Disable the GCSE optimisation
--nolospre Disable lospre
--nogenconstprop Disable generalized constant propagation
--nolabelopt Disable label optimisation
--noinvariant Disable optimisation of invariants
--noinduction Disable loop variable induction
--noloopreverse Disable the loop reverse optimisation
--no-peep Disable the peephole assembly file optimisation
--peep-asm Enable peephole optimization on inline assembly
--peep-return Enable peephole optimization for return instructions
--no-peep-return Disable peephole optimization for return instructions
--peep-file <file> use this extra peephole file
--allow-unsafe-read Allow optimizations to read any memory location anytime
Internal debugging options:
--dump-ast Dump front-end AST before generating i-code
--dump-i-code Dump the i-code structure at all stages
--dump-graphs Dump graphs (control-flow, conflict, etc)
--i-code-in-asm Include i-code as comments in the asm file
--fverbose-asm Include code generator comments in the asm output
Linker options:
-l Include the given library in the link
-L Add the next field to the library search path
--lib-path <path> use this path to search for libraries
--out-fmt-ihx Output in Intel hex format
--out-fmt-s19 Output in S19 hex format
--xram-loc <nnnn> External Ram start location
--xram-size <nnnn> External Ram size
--iram-size <nnnn> Internal Ram size
--xstack-loc <nnnn> External Stack start location
--code-loc <nnnn> Code Segment Location
--code-size <nnnn> Code Segment size
--stack-loc <nnnn> Stack pointer initial value
--data-loc <nnnn> Direct data start location
--idata-loc
--no-optsdcc-in-asm Do not emit .optsdcc in asm
Special options for the mcs51 port:
--model-small internal data space is used (default)
--model-medium external paged data space is used
--model-large external data space is used
--model-huge functions are banked, data in external space
--stack-size Tells the linker to allocate this space for stack
--acall-ajmp Use acall/ajmp instead of lcall/ljmp
--no-ret-without-call Do not use ret independent of acall/lcall
Special options for the z80 port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
--allow-undocumented-instructions Allow use of undocumented instructions
Special options for the z180 port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the r2k port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the r2ka port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the r3ka port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the sm83 port:
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--callee-saves-bc Force a called function to always save BC
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--legacy-banking Use legacy method to call banked functions
--sdcccall Set ABI version for default calling convention
Special options for the tlcs90 port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the ez80_z80 port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the z80n port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the r800 port:
--callee-saves-bc Force a called function to always save BC
--portmode= Determine PORT I/O mode (z80/z180)
-bo <num> use code bank <num>
-ba <num> use data bank <num>
--asm= Define assembler name (rgbds/asxxxx/isas/z80asm/gas)
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--dataseg <name> use this name for the data segment
--no-std-crt0 Do not link default crt0.rel
--reserve-regs-iy Do not use IY (incompatible with --fomit-frame-pointer)
--fno-omit-frame-pointer Do not omit frame pointer
--emit-externs Emit externs list in generated asm
--legacy-banking Use legacy method to call banked functions
--nmos-z80 Generate workaround for NMOS Z80 when saving IFF2
--sdcccall Set ABI version for default calling convention
Special options for the ds390 port:
--model-flat24 use the flat24 model for the ds390 (default)
--stack-8bit use the 8bit stack for the ds390 (not supported yet)
--stack-size Tells the linker to allocate this space for stack
--stack-10bit use the 10bit stack for ds390 (default)
--use-accelerator generate code for ds390 arithmetic accelerator
--protect-sp-update will disable interrupts during ESP:SP updates
--parms-in-bank1 use Bank1 for parameter passing
Special options for the pic16 port:
--pstack-model= use stack model 'small' (default) or 'large'
-y --extended enable Extended Instruction Set/Literal Offset Addressing mode
--pno-banksel do not generate BANKSEL assembler directives
--obanksel= set banksel optimization level (default=0 no)
--denable-peeps explicit enable of peepholes
--no-optimize-goto do NOT use (conditional) BRA instead of GOTO
--optimize-cmp try to optimize some compares
--optimize-df thoroughly analyze data flow (memory and time intensive!)
--asm= Use alternative assembler
--mplab-comp enable compatibility mode for MPLAB utilities (MPASM/MPLINK)
--link= Use alternative linker
--preplace-udata-with= Place udata variables at another section: udata_acs, udata_ovr, udata_shr
--ivt-loc= Set address of interrupt vector table.
--nodefaultlibs do not link default libraries when linking
--use-crt= use <crt-o> run-time initialization module
--no-crt do not link any default run-time initialization module
--debug-xtra show more debug info in assembly output
--debug-ralloc dump register allocator debug file *.d
--pcode-verbose dump pcode related info
--calltree dump call tree in .calltree file
--gstack trace stack pointer push/pop to overflow
--no-warn-non-free suppress warning on absent --use-non-free option
Special options for the pic14 port:
--debug-xtra show more debug info in assembly output
--no-pcode-opt disable (slightly faulty) optimization on pCode
--stack-size sets the size if the argument passing stack (default: 16, minimum: 4)
--no-extended-instructions forbid use of the extended instruction set (e.g., ADDFSR)
--no-warn-non-free suppress warning on absent --use-non-free option
Special options for the TININative port:
--model-flat24 use the flat24 model for the ds390 (default)
--stack-8bit use the 8bit stack for the ds390 (not supported yet)
--stack-size Tells the linker to allocate this space for stack
--stack-10bit use the 10bit stack for ds390 (default)
--use-accelerator generate code for ds390 arithmetic accelerator
--protect-sp-update will disable interrupts during ESP:SP updates
--parms-in-bank1 use Bank1 for parameter passing
--tini-libid <nnnn> LibraryID used in -mTININative
Special options for the ds400 port:
--model-flat24 use the flat24 model for the ds400 (default)
--stack-8bit use the 8bit stack for the ds400 (not supported yet)
--stack-size Tells the linker to allocate this space for stack
--stack-10bit use the 10bit stack for ds400 (default)
--use-accelerator generate code for ds400 arithmetic accelerator
--protect-sp-update will disable interrupts during ESP:SP updates
--parms-in-bank1 use Bank1 for parameter passing
Special options for the hc08 port:
--model-small 8-bit address space for data
--model-large 16-bit address space for data (default)
--out-fmt-elf Output executable in ELF format
Special options for the s08 port:
--model-small 8-bit address space for data
--model-large 16-bit address space for data (default)
--out-fmt-elf Output executable in ELF format
Special options for the stm8 port:
--model-medium 16-bit address space for both data and code (default)
--model-large 16-bit address space for data, 24-bit for code
--codeseg <name> use this name for the code segment
--constseg <name> use this name for the const segment
--out-fmt-elf Output executable in ELF format
--sdcccall Set ABI version for default calling convention
Special options for the mos6502 port:
--model-small 8-bit address space for data
--model-large 16-bit address space for data (default)
--no-zp-spill place register spills in 16-bit address space
--no-std-crt0 Do not link default crt0.rel
Special options for the mos65c02 port:
--model-small 8-bit address space for data
--model-large 16-bit address space for data (default)
--no-zp-spill place register spills in 16-bit address space
--no-std-crt0 Do not link default crt0.rel
Special options for the f8 port:
ãã®ããã«è²ã ãã«ãã衚瀺ãããã°åé¡ãªããã¹ãéãã³ã³ãã€ã«ã§ããç°å¢ãæŽã£ãŠããããšã«ãªããŸãã
次ã¯ã³ãŒããšãã£ã¿åŽã§SDCCã䜿ããããã«ããŸãããã
ä»åã¯VisualStudioCodeäžã§éçºãæ³å®ããŠãã®äžã§ã³ã³ãã€ã«ã§ããç°å¢ãèããŠã¿ãŸãã
ãŸãã¯äœãããã³ã³ãã€ã«ã§ãããœãŒã¹ã³ãŒããçšæããŸããSDCCã䜿ãç°å¢ã®å Žåããäžå¯§ã«initãããã²ãªåœ¢ã®ãã¡ã€ã«æ§æãäœã£ãŠãããå Žåã®æ¹ãçšãªã¯ããªã®ã§ãã²ãšãŸããµã³ãã«ã³ãŒãã®ãããªãã®ãçšæããŠããããéçºãå§ããã®ãäžçªæã£åãæ©ãã§ãã
ãšããããã§ç§ã®å Žåã¯PADAUKã®Free PDKã®ãµã€ããæ¢ããŠäœ¿ããããªãµã³ãã«ã³ãŒããæ¢ããŠããŸãããã²ãšãŸããããVisual Studio Codeã®ãã¡ã€ã«ã®éšåã§éããŸãã

次ã«ã³ã³ãã€ã©ã®èšå®ãããŸããäžã®ç»åã ãšã¿ãã®è¡šç€ºã®æšªã«ãããâŠããæŒããŠã¿ãŒããã«âã¿ã¹ã¯ã®æ§æâãã³ãã¬ãŒãããtasks.jsonãçæãæ€çŽ¢æ¬ã«è¡šç€ºãããã®ã§ãããããããã«ã»ãã®ã³ãã³ããå®è¡ããäŸãéžã³ãŸãã
ãããštasks.jsonãçæãããã®ã§ããããSDCCã䜿ãããã«ç·šéããŸãããã¡ãã®ãµã€ãã«äŸãèŒã£ãŠããã®ã§ãããæåããŸãã
{
"version": "2.0.0",
"tasks": [
{
"label": "sdcc",
"type": "shell",
"command": "_sdcc",
"args": [
"main"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
次ã«ä»¥äžã®ãC/C++ãã®æ¡åŒµæ©èœãå ¥ããŸããçºè¡å ã¯Microsoftãªã®ã§å®å¿å®å šã

次ã¯å·Šäžã®æ¯è»ããŒã¯ããã³ãã³ããã¬ããâC/C++ãæ€çŽ¢ããŠEdit Configurations (UI)ãéžã³ãŸãã

ãããšè²ã èšå®é ç®ãåºãŠããã®ã§æ§æåãé©åœã«æ±ºããŸãã

ã³ã³ãã€ã©ãã¹ã«ã¯å ã»ã©ç°å¢å€æ°ã§èšå®ãããå Žæã«å ¥ã£ãŠããsdcc.exeããã«ãã¹ã§æå®ããŠãããŸããããã§1ããæžããŠãã£ããšãã®ã³ã³ãã€ã«ç°å¢ãã§ããŸããã
Makefileãããå Žå
ãããŸã§ãã£ãŠãããŠæ°ã¥ããã®ã§ãããMakefileãããå Žåã¯makeããã ãã§ããã®ã§VSCodeäžã§makeããŠã¿ãŸããå®éãç§ãä»åãµã³ãã«ã«çšæãããããžã§ã¯ãã«ã¯Makefileãå«ãŸããŠããŸããã
ãã ãWindowsç°å¢ã§makeããå Žåã¯ãŸãå¥ã«èšå®ããããå ã»ã©äœæããtasks.jsonãäžžã å€æŽããå¿ èŠããããŸãã
ãŸãåãã«Make for Windowsãã€ã³ã¹ããŒã«ããŸãããµã€ãã®äžã®æ¹ããã€ã³ã¹ããŒã©ãããŠã³ããŒãããŠã²ããã次ãžãæŒããŠããã°çµãããŸãã
ããããå®ã¯ãã®ã€ã³ã¹ããŒã©ã¯ç°å¢å€æ°ãèšå®ãããªãã®ã§ãç°å¢å€æ°ãšããŠmakeãèšå®ããå¿ èŠããããŸããããã©ã«ãèšå®ã¯ä»¥äžã®ããã«ãªã£ãŠããã®ã§ãããç°å¢å€æ°ã®Pathã«è¿œå ããŸãã
C:\Program Files (x86)\GnuWin32\bin
è¿œå ãããã³ãã³ãããã³ãããéããŠä»¥äžã®ããã«ã³ãã³ããããããŠã¿ãŸãã
make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
ããã¯ããªãŒãœãããŠã§ã¢ã§ã. å©çšèš±è«Ÿã«ã€ããŠã¯ãœãŒã¹ã
ã芧ãã ãã.
åæ¥æ§ãç¹å®ã®ç®çãžã®é©åæ§ã®åŠäœã«é¢ããã, ç¡ä¿èšŒã§ã.
This program built for i386-pc-mingw32
ãããªæãã«åºãã°ãã¹ãæ£ããéã£ãŠããŸãã
ã²ãšãŸããã¹ãéããã®ã§Terminaläžã§makeãããŠã¿ãŠãæ§æãšã©ãŒã衚瀺ãããŠããŸãè¡ããŸããã§ãããã©ãèããŠãWindowsã§Makefileã解éããéã®åœ±é¿ãªã®ã§ãããããããã¡ãã¡çŽãã®ãé¢åãšããããšã§çµå±åé ã®WSLã«éããæ¹ãæ©ããšããããšã§éãããšããé¡æ«ã§ãã
ãŸãšã
ãã¯ãSDCCã«ããçµã¿èŸŒã¿éçºã¯ã·ã³ãã«ã«Linuxãäžçªæ¥œã ãšæããŸãããç°å¢ã代ããã«ãããšããç¹ã¯çŽ æŽãããã§ããWindowsã§ããããã¡ããæ軜ã§æ¥œãªã®ã§ãããWindowsã¢ããããŒããããåããªãã¿ãããªé¢åããªãã®ãè¯ãç¹ã§ãããã¯ãéçºç°å¢ã¯éé¢ããŠããã«éããŸããã
äœã¯ãšãããWindowsã§ã¯ãã«ãã§ããŸããã§ããããLinuxãªãã¹ã ãŒãºã«ã§ããç¹ãæè¿ã¯WSLã®ãããã§ç°¡åã«Linuxãã€ã³ã¹ããŒã«ã§ããããã«ãªã£ãã®ã§ãã®æ©æµãæããããšãã§ããŸããæ¬åœã¯è¥å¹²WLSã«æµæã¯ãã£ããã®ã§ãããWindowsäžã§ç°å¢ãéé¢ããŠãããã®ã¯æ¥œã ãšæããŸããã
以äžã§ãããèªã¿ããã ãããããšãããããŸããã