{"id":284,"date":"2013-02-24T16:51:25","date_gmt":"2013-02-24T20:51:25","guid":{"rendered":"http:\/\/jimlund.org\/blog\/?p=284"},"modified":"2013-02-24T16:51:25","modified_gmt":"2013-02-24T20:51:25","slug":"compiling-for-pic18-using-sdcc","status":"publish","type":"post","link":"http:\/\/jimlund.org\/blog\/?p=284","title":{"rendered":"Compiling for pic18 using sdcc"},"content":{"rendered":"<p>Upgraded to sdcc 3.2.0 from 2.9.0, and gputils to 1.0.0.  The build commands I was using didn&#8217;t work, chnages to the .c file and build commands were needed:<\/p>\n<p>Changes to the .c file:<br \/>\nDrop:<br \/>\n<code><br \/>\n__code char __at(__CONFIG1H) __conf1h = _OSC_INTIO67_1H;<br \/>\n__code char __at(__CONFIG2H) __conf2h = _WDT_OFF_2H; \/\/out for p18f4620<br \/>\n__code char __at(__CONFIG2L) __conf2l = _PWRT_OFF_2L & _BOREN_OFF_2L;<br \/>\n__code char __at(__CONFIG3H) __conf3h = _MCLRE_OFF_3H & _PBADEN_OFF_3H; \/\/out for p18f4620<br \/>\n__code char __at(__CONFIG4L) __conf4l = _XINST_OFF_4L & _DEBUG_OFF_4L & _LVP_ON_4L;<br \/>\n<\/code><\/p>\n<p>Add:<br \/>\n<code><br \/>\n#include \"pic18f46k20.h\"<br \/>\n#pragma config FOSC=INTIO67, BOREN=OFF, PWRT=OFF, MCLRE=OFF, PBADEN=OFF, XINST=OFF, DEBUG=OFF, LVP=ON, WDTEN=OFF<br \/>\n\/\/Instead of WDT=OFF, see the .inc file<br \/>\n\/\/Instead of OSC, use FOSC, see the .inc file<br \/>\n<\/code><\/p>\n<p>The CONFIG settings in \/usr\/local\/share\/sdcc\/non-free\/include\/pic16\/pic18f46k20.h and \/usr\/local\/share\/gputils\/header\/p18f46k20.inc do not match.  WDT changes to WDTEN, OSC to FOSC<\/p>\n<p>Command to compile:<br \/>\n<code><br \/>\n\/usr\/local\/bin\/sdcc -V -mpic16 --use-non-free  -p18f46k20 -c p18_step_control.c   -Wl\"-s .\/18f46k20.lkr\"<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Upgraded to sdcc 3.2.0 from 2.9.0, and gputils to 1.0.0. The build commands I was using didn&#8217;t work, chnages to the .c file and build commands were needed: Changes to the .c file: Drop: __code char __at(__CONFIG1H) __conf1h = _OSC_INTIO67_1H; __code char __at(__CONFIG2H) __conf2h = _WDT_OFF_2H; \/\/out for p18f4620 __code char __at(__CONFIG2L) __conf2l = _PWRT_OFF_2L [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-284","post","type-post","status-publish","format-standard","hentry","category-hobbies"],"_links":{"self":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=284"}],"version-history":[{"count":0,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/284\/revisions"}],"wp:attachment":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}