about to add border tracing, thick in the weeds

This commit is contained in:
Brett Weiland 2025-06-05 00:38:21 -05:00
parent 058f49254b
commit 7b1f043ac5
40 changed files with 17344 additions and 2031 deletions

BIN
border_tracing_test.xcf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
/home/indigo/projects/stm32_buisnesscard/kicad/stm32card/_autosave-stm32card.kicad_sch

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -164,7 +164,7 @@
(net 39 "Net-(U1-SW)")
(net 40 "unconnected-(U4-PB11-Pad22)")
(net 41 "unconnected-(U4-PB3-Pad39)")
(net 42 "unconnected-(U4-PB15-Pad28)")
(net 42 "unconnected-(U4-PB10-Pad21)")
(net 43 "unconnected-(U4-PD0-OSC_IN-Pad5)")
(net 44 "unconnected-(U4-PB4-Pad40)")
(net 45 "Net-(R10-Pad1)")
@ -1554,12 +1554,13 @@
(footprint "Package_TO_SOT_SMD:SOT-23"
(layer "F.Cu")
(uuid "2518d603-05ec-45f5-b810-40511013584b")
(at 184.40183 107.755646)
(at 159.273241 115.503476 180)
(descr "SOT, 3 Pin (JEDEC TO-236 Var AB https://www.jedec.org/document_search?search_api_views_fulltext=TO-236), generated with kicad-footprint-generator ipc_gullwing_generator.py")
(tags "SOT TO_SOT_SMD")
(property "Reference" "Q1"
(at 0 -2.4 0)
(layer "F.SilkS")
(hide yes)
(uuid "fce2c4d8-b23f-4b76-864e-54af29531ec1")
(effects
(font
@ -1571,6 +1572,7 @@
(property "Value" "AO3400A"
(at 0 2.4 0)
(layer "F.Fab")
(hide yes)
(uuid "0b3f4ffa-e528-40a9-97fa-3cc91c0b2ad2")
(effects
(font
@ -1609,24 +1611,14 @@
(sheetfile "stm32card.kicad_sch")
(attr smd)
(fp_line
(start 0 -1.56)
(end -0.65 -1.56)
(start 0 1.56)
(end 0.65 1.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "2b5048ba-809a-434e-b0f4-ba02947d6464")
)
(fp_line
(start 0 -1.56)
(end 0.65 -1.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "0e870119-3b1f-41e9-b813-8dcbd3f632cb")
(uuid "9c21a164-a516-4c80-80b9-38ddd69a7d7f")
)
(fp_line
(start 0 1.56)
@ -1639,14 +1631,24 @@
(uuid "4c60d1da-e04a-42c2-b9d9-5e56e59fc40f")
)
(fp_line
(start 0 1.56)
(end 0.65 1.56)
(start 0 -1.56)
(end 0.65 -1.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "9c21a164-a516-4c80-80b9-38ddd69a7d7f")
(uuid "0e870119-3b1f-41e9-b813-8dcbd3f632cb")
)
(fp_line
(start 0 -1.56)
(end -0.65 -1.56)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "2b5048ba-809a-434e-b0f4-ba02947d6464")
)
(fp_poly
(pts
@ -1672,34 +1674,14 @@
(uuid "2c3e7d9d-1044-43f5-acac-fc3d891a3ecb")
)
(fp_line
(start -0.65 -1.125)
(end -0.325 -1.45)
(start 0.65 1.45)
(end -0.65 1.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "6a3f6376-4a4a-4240-92f8-36832ead3c32")
)
(fp_line
(start -0.65 1.45)
(end -0.65 -1.125)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "aa36c59c-98ca-4806-82b7-6e6d13a325f4")
)
(fp_line
(start -0.325 -1.45)
(end 0.65 -1.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "2440cb88-c0c9-48fb-9cb1-48474d2cdd4e")
(uuid "d434d20a-59c7-4610-bfbc-416f46375bbb")
)
(fp_line
(start 0.65 -1.45)
@ -1712,14 +1694,34 @@
(uuid "bc74b339-6e12-448e-8069-b412043c318f")
)
(fp_line
(start 0.65 1.45)
(end -0.65 1.45)
(start -0.325 -1.45)
(end 0.65 -1.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "d434d20a-59c7-4610-bfbc-416f46375bbb")
(uuid "2440cb88-c0c9-48fb-9cb1-48474d2cdd4e")
)
(fp_line
(start -0.65 1.45)
(end -0.65 -1.125)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "aa36c59c-98ca-4806-82b7-6e6d13a325f4")
)
(fp_line
(start -0.65 -1.125)
(end -0.325 -1.45)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "6a3f6376-4a4a-4240-92f8-36832ead3c32")
)
(fp_text user "${REFERENCE}"
(at 0 0 0)
@ -1733,7 +1735,7 @@
)
)
(pad "1" smd roundrect
(at -0.9375 -0.95)
(at -0.9375 -0.95 180)
(size 1.475 0.6)
(layers "F.Cu" "F.Mask" "F.Paste")
(roundrect_rratio 0.25)
@ -1743,7 +1745,7 @@
(uuid "ef84f103-7a72-4e51-b179-6de690d33df1")
)
(pad "2" smd roundrect
(at -0.9375 0.95)
(at -0.9375 0.95 180)
(size 1.475 0.6)
(layers "F.Cu" "F.Mask" "F.Paste")
(roundrect_rratio 0.25)
@ -1753,7 +1755,7 @@
(uuid "974a4e27-587c-4a22-9225-87b99ac158ca")
)
(pad "3" smd roundrect
(at 0.9375 0)
(at 0.9375 0 180)
(size 1.475 0.6)
(layers "F.Cu" "F.Mask" "F.Paste")
(roundrect_rratio 0.25)
@ -6156,194 +6158,6 @@
)
)
)
(footprint "LOGO"
(layer "F.Cu")
(uuid "90e132f6-dfe8-4306-aee9-1a2c345dcedf")
(at 139.84371 112.108205)
(property "Reference" "G***"
(at 0 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "bb536596-2ce2-481e-8f0a-5954bf5ca76d")
(effects
(font
(size 1.5 1.5)
(thickness 0.3)
)
)
)
(property "Value" "LOGO"
(at 0.75 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "da169875-043a-4dc2-9a55-76a1464fe506")
(effects
(font
(size 1.5 1.5)
(thickness 0.3)
)
)
)
(property "Datasheet" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "8555601d-9872-4c8b-accf-4a1891465380")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(property "Description" ""
(at 0 0 0)
(layer "F.Fab")
(hide yes)
(uuid "99c7bf92-7cc7-4f63-9158-ee4410b43de0")
(effects
(font
(size 1.27 1.27)
(thickness 0.15)
)
)
)
(attr board_only exclude_from_pos_files exclude_from_bom)
(fp_poly
(pts
(xy -2.510194 -4.738118) (xy -2.43064 -4.671599) (xy -2.385896 -4.617848) (xy -2.327166 -4.538602)
(xy -2.289448 -4.483095) (xy -2.265143 -4.435879) (xy -2.246653 -4.381505) (xy -2.226379 -4.304527)
(xy -2.220627 -4.281854) (xy -2.193293 -4.176056) (xy -2.164588 -4.067734) (xy -2.146934 -4.002866)
(xy -2.123798 -3.910033) (xy -2.099615 -3.798584) (xy -2.085298 -3.723879) (xy -2.058721 -3.614411)
(xy -2.018649 -3.492899) (xy -1.983922 -3.408501) (xy -1.891089 -3.212257) (xy -1.814514 -3.057726)
(xy -1.752456 -2.941565) (xy -1.703171 -2.860431) (xy -1.684492 -2.83419) (xy -1.64679 -2.778644)
(xy -1.62652 -2.736869) (xy -1.625406 -2.730307) (xy -1.61514 -2.697773) (xy -1.587761 -2.633832)
(xy -1.548401 -2.550198) (xy -1.531731 -2.516415) (xy -1.484182 -2.417484) (xy -1.442017 -2.323099)
(xy -1.412837 -2.250443) (xy -1.408613 -2.238154) (xy -1.380336 -2.174013) (xy -1.347849 -2.130805)
(xy -1.341395 -2.126227) (xy -1.317837 -2.092516) (xy -1.288223 -2.018894) (xy -1.25458 -1.913291)
(xy -1.218934 -1.783639) (xy -1.18331 -1.637868) (xy -1.149733 -1.483909) (xy -1.12023 -1.329694)
(xy -1.096826 -1.183151) (xy -1.092646 -1.152341) (xy -1.068984 -1.002236) (xy -1.043106 -0.895579)
(xy -1.015549 -0.834056) (xy -0.986849 -0.81935) (xy -0.986587 -0.819435) (xy -0.967707 -0.834094)
(xy -0.952974 -0.867325) (xy -0.941933 -0.924117) (xy -0.934126 -1.009456) (xy -0.929099 -1.128331)
(xy -0.926393 -1.28573) (xy -0.925554 -1.486618) (xy -0.924196 -1.624099) (xy 0.21207 -1.624099)
(xy 0.212415 -1.513987) (xy 0.225541 -1.408812) (xy 0.245951 -1.338323) (xy 0.298917 -1.26795) (xy 0.379628 -1.224641)
(xy 0.474149 -1.210629) (xy 0.568542 -1.228144) (xy 0.643901 -1.274595) (xy 0.691037 -1.337035)
(xy 0.712183 -1.417128) (xy 0.710292 -1.483597) (xy 1.406902 -1.483597) (xy 1.419572 -1.366865)
(xy 1.449856 -1.266696) (xy 1.459476 -1.247648) (xy 1.50156 -1.183491) (xy 1.547029 -1.148916) (xy 1.613291 -1.134186)
(xy 1.668217 -1.130895) (xy 1.728649 -1.137722) (xy 1.772101 -1.171708) (xy 1.796545 -1.206925)
(xy 1.829297 -1.27808) (xy 1.835454 -1.356242) (xy 1.83166 -1.394939) (xy 1.815784 -1.503581) (xy 1.798012 -1.576748)
(xy 1.772805 -1.627348) (xy 1.73462 -1.66829) (xy 1.703609 -1.693258) (xy 1.613706 -1.743427) (xy 1.532581 -1.754055)
(xy 1.46783 -1.725348) (xy 1.438303 -1.686056) (xy 1.412821 -1.596719) (xy 1.406902 -1.483597) (xy 0.710292 -1.483597)
(xy 0.70911 -1.525173) (xy 0.69886 -1.593955) (xy 0.667286 -1.714997) (xy 0.618904 -1.794825) (xy 0.547274 -1.839626)
(xy 0.445961 -1.855585) (xy 0.426264 -1.855875) (xy 0.345937 -1.853068) (xy 0.297645 -1.840593)
(xy 0.265039 -1.812367) (xy 0.249222 -1.790009) (xy 0.224381 -1.721867) (xy 0.21207 -1.624099) (xy -0.924196 -1.624099)
(xy -0.923821 -1.662025) (xy -0.919008 -1.85601) (xy -0.911567 -2.06096) (xy -0.901952 -2.269262)
(xy -0.890616 -2.473301) (xy -0.878011 -2.665465) (xy -0.864591 -2.838138) (xy -0.850809 -2.983709)
(xy -0.837117 -3.094563) (xy -0.82638 -3.153773) (xy -0.780362 -3.338177) (xy -0.74107 -3.476756)
(xy -0.707741 -3.571623) (xy -0.679607 -3.624891) (xy -0.655906 -3.638672) (xy -0.651467 -3.636777)
(xy -0.631937 -3.641862) (xy -0.630755 -3.649667) (xy -0.612501 -3.673269) (xy -0.565837 -3.672946)
(xy -0.502914 -3.651404) (xy -0.43588 -3.611348) (xy -0.42658 -3.604196) (xy -0.352411 -3.538924)
(xy -0.290947 -3.473367) (xy -0.251721 -3.418512) (xy -0.242598 -3.392111) (xy -0.230134 -3.360461)
(xy -0.198975 -3.30663) (xy -0.186051 -3.286769) (xy -0.149728 -3.22366) (xy -0.104573 -3.132771)
(xy -0.059181 -3.0316) (xy -0.05031 -3.010412) (xy 0.011035 -2.869598) (xy 0.064819 -2.766906) (xy 0.117108 -2.693893)
(xy 0.173967 -2.642114) (xy 0.24146 -2.603126) (xy 0.242598 -2.602589) (xy 0.282785 -2.584571) (xy 0.320963 -2.571379)
(xy 0.364736 -2.562561) (xy 0.421709 -2.557664) (xy 0.499487 -2.556235) (xy 0.605677 -2.557823)
(xy 0.747882 -2.561973) (xy 0.861222 -2.565762) (xy 0.973401 -2.565824) (xy 1.089789 -2.560058)
(xy 1.165721 -2.552199) (xy 1.300402 -2.53286) (xy 1.449304 -2.685628) (xy 1.507654 -2.750859) (xy 1.577366 -2.836937)
(xy 1.652327 -2.935275) (xy 1.72642 -3.037287) (xy 1.793531 -3.134386) (xy 1.847545 -3.217985) (xy 1.882348 -3.279498)
(xy 1.892263 -3.30765) (xy 1.911935 -3.328168) (xy 1.959323 -3.357343) (xy 2.016988 -3.386082) (xy 2.067491 -3.405292)
(xy 2.085678 -3.408501) (xy 2.107774 -3.384945) (xy 2.121081 -3.315498) (xy 2.125567 -3.20199) (xy 2.121201 -3.046253)
(xy 2.107953 -2.850119) (xy 2.097204 -2.729205) (xy 2.053602 -2.271154) (xy 2.10776 -2.081709) (xy 2.135263 -1.97471)
(xy 2.157232 -1.869429) (xy 2.169296 -1.787055) (xy 2.169795 -1.780827) (xy 2.178967 -1.702027)
(xy 2.195894 -1.597044) (xy 2.217139 -1.486905) (xy 2.220094 -1.47305) (xy 2.24358 -1.314469) (xy 2.243077 -1.155463)
(xy 2.217406 -0.983938) (xy 2.165389 -0.787801) (xy 2.148002 -0.73311) (xy 2.119162 -0.640644) (xy 2.097537 -0.563357)
(xy 2.086862 -0.514849) (xy 2.086342 -0.508619) (xy 2.070822 -0.450681) (xy 2.030186 -0.373329)
(xy 1.973318 -0.29176) (xy 1.930828 -0.242599) (xy 1.875275 -0.171732) (xy 1.824811 -0.087316) (xy 1.815463 -0.067827)
(xy 1.79042 -0.002657) (xy 1.781335 0.057008) (xy 1.786545 0.131786) (xy 1.794913 0.1869) (xy 1.81296 0.286846)
(xy 1.83292 0.383715) (xy 1.845453 0.436675) (xy 1.869052 0.529413) (xy 1.892313 0.624061) (xy 1.893914 0.630754)
(xy 1.914735 0.697215) (xy 1.950311 0.790832) (xy 1.994229 0.895101) (xy 2.011734 0.934001) (xy 2.073132 1.066467)
(xy 2.138151 1.204576) (xy 2.201997 1.338352) (xy 2.259875 1.457819) (xy 2.30699 1.553) (xy 2.338195 1.613275)
(xy 2.361383 1.65802) (xy 2.40038 1.73571) (xy 2.449849 1.835621) (xy 2.50445 1.947032) (xy 2.507317 1.952912)
(xy 2.586487 2.112467) (xy 2.665964 2.267418) (xy 2.741995 2.410898) (xy 2.810826 2.536041) (xy 2.868703 2.635978)
(xy 2.911874 2.703844) (xy 2.931221 2.728477) (xy 2.962308 2.771817) (xy 2.999373 2.839878) (xy 3.015363 2.874273)
(xy 3.060617 2.962535) (xy 3.127925 3.075544) (xy 3.208673 3.20045) (xy 3.294249 3.3244) (xy 3.376037 3.434546)
(xy 3.445423 3.518035) (xy 3.450701 3.523734) (xy 3.497654 3.562721) (xy 3.536348 3.578318) (xy 3.578722 3.591605)
(xy 3.634724 3.623853) (xy 3.638501 3.626505) (xy 3.703518 3.666175) (xy 3.786055 3.708312) (xy 3.815921 3.721736)
(xy 3.874945 3.749626) (xy 3.913721 3.779807) (xy 3.939475 3.824057) (xy 3.959429 3.894156) (xy 3.977742 3.98559)
(xy 3.98894 4.152089) (xy 3.957999 4.300227) (xy 3.886799 4.425732) (xy 3.777221 4.524331) (xy 3.728169 4.552709)
(xy 3.623733 4.5866) (xy 3.506995 4.59452) (xy 3.394775 4.577684) (xy 3.303891 4.537308) (xy 3.283061 4.520561)
(xy 3.240239 4.48805) (xy 3.189891 4.471613) (xy 3.115186 4.467004) (xy 3.073068 4.467558) (xy 2.986597 4.466078)
(xy 2.915773 4.458561) (xy 2.882599 4.449361) (xy 2.840784 4.406116) (xy 2.794363 4.322317) (xy 2.746761 4.205256)
(xy 2.702246 4.06523) (xy 2.651685 3.931959) (xy 2.583487 3.834653) (xy 2.576757 3.827753) (xy 2.518373 3.756313)
(xy 2.461426 3.666158) (xy 2.437899 3.619829) (xy 2.385164 3.525651) (xy 2.31718 3.431694) (xy 2.285135 3.395555)
(xy 2.217925 3.316447) (xy 2.156525 3.227681) (xy 2.134855 3.189347) (xy 2.094768 3.126164) (xy 2.027759 3.037626)
(xy 1.941412 2.932484) (xy 1.843311 2.819493) (xy 1.74104 2.707405) (xy 1.642183 2.604974) (xy 1.560805 2.526822)
(xy 1.500662 2.462385) (xy 1.456728 2.397601) (xy 1.443202 2.364168) (xy 1.417281 2.308891) (xy 1.381174 2.279901)
(xy 1.341315 2.252211) (xy 1.290505 2.197611) (xy 1.260395 2.157502) (xy 1.19465 2.080703) (xy 1.13572 2.051686)
(xy 1.083104 2.070266) (xy 1.067431 2.086341) (xy 1.049152 2.115777) (xy 1.052093 2.122731) (xy 1.04974 2.138137)
(xy 1.025412 2.17125) (xy 0.983125 2.208004) (xy 0.95287 2.21977) (xy 0.924197 2.23382) (xy 0.921872 2.242395)
(xy 0.901963 2.267471) (xy 0.876881 2.2793) (xy 0.831766 2.305452) (xy 0.775772 2.352611) (xy 0.761647 2.366731)
(xy 0.698923 2.419695) (xy 0.61411 2.475732) (xy 0.521683 2.52694) (xy 0.436121 2.565416) (xy 0.371901 2.583255)
(xy 0.364259 2.583667) (xy 0.300634 2.59457) (xy 0.272593 2.605656) (xy 0.162494 2.647283) (xy 0.028634 2.674821)
(xy -0.105155 2.683622) (xy -0.124 2.683027) (xy -0.204894 2.681779) (xy -0.254573 2.691232) (xy -0.290054 2.716776)
(xy -0.312013 2.742589) (xy -0.343284 2.791442) (xy -0.358712 2.845277) (xy -0.35833 2.91452) (xy -0.342169 3.009599)
(xy -0.313225 3.129512) (xy -0.286435 3.235542) (xy -0.261775 3.33701) (xy -0.244024 3.414198) (xy -0.242279 3.422338)
(xy -0.218481 3.514619) (xy -0.188238 3.608003) (xy -0.18509 3.616417) (xy -0.16108 3.696833) (xy -0.136337 3.808359)
(xy -0.113175 3.936408) (xy -0.093905 4.066396) (xy -0.08084 4.183738) (xy -0.076292 4.27385) (xy -0.077194 4.296929)
(xy -0.09211 4.368983) (xy -0.126636 4.408407) (xy -0.139494 4.414969) (xy -0.181238 4.439899) (xy -0.194078 4.457423)
(xy -0.213948 4.473586) (xy -0.232707 4.47593) (xy -0.278089 4.490174) (xy -0.332984 4.524424) (xy -0.333017 4.52445)
(xy -0.383958 4.558368) (xy -0.421378 4.572958) (xy -0.421983 4.57297) (xy -0.455662 4.591351) (xy -0.476565 4.616684)
(xy -0.515764 4.650023) (xy -0.581764 4.681793) (xy -0.609764 4.691107) (xy -0.694524 4.71592) (xy -0.773687 4.739457)
(xy -0.790166 4.744432) (xy -0.864526 4.757288) (xy -0.968159 4.76325) (xy -1.084181 4.762671) (xy -1.195705 4.755906)
(xy -1.285845 4.743308) (xy -1.322159 4.733283) (xy -1.375276 4.703451) (xy -1.402564 4.670245)
(xy -1.40275 4.669463) (xy -1.423863 4.62887) (xy -1.465468 4.576067) (xy -1.472916 4.568039) (xy -1.522327 4.486028)
(xy -1.548499 4.379565) (xy -1.548951 4.268055) (xy -1.523199 4.174919) (xy -1.456456 3.98269) (xy -1.430172 3.767419)
(xy -1.444792 3.533501) (xy -1.453306 3.481279) (xy -1.496465 3.24496) (xy -1.534287 3.045694) (xy -1.569023 2.872611)
(xy -1.602925 2.714843) (xy -1.638244 2.56152) (xy -1.675573 2.408427) (xy -1.703765 2.302757) (xy -1.729073 2.232112)
(xy -1.757823 2.183879) (xy -1.79634 2.145445) (xy -1.814803 2.130824) (xy -1.896217 2.086397) (xy -1.98232 2.066975)
(xy -2.057228 2.074533) (xy -2.093716 2.096141) (xy -2.134509 2.120346) (xy -2.148551 2.122731)
(xy -2.188983 2.141441) (xy -2.25033 2.192522) (xy -2.325966 2.268397) (xy -2.409264 2.361493) (xy -2.493599 2.464232)
(xy -2.572344 2.56904) (xy -2.638873 2.668342) (xy -2.665748 2.714031) (xy -2.718694 2.802539) (xy -2.774355 2.884474)
(xy -2.814952 2.935434) (xy -2.864131 3.005855) (xy -2.896947 3.083093) (xy -2.899338 3.093122)
(xy -2.916153 3.156873) (xy -2.934046 3.199737) (xy -2.935851 3.202291) (xy -2.948168 3.237934)
(xy -2.962569 3.309251) (xy -2.977254 3.403553) (xy -2.990421 3.508152) (xy -3.000268 3.610359)
(xy -3.004734 3.687487) (xy -3.016688 3.813085) (xy -3.042736 3.942284) (xy -3.079411 4.06614) (xy -3.123245 4.175709)
(xy -3.170771 4.262048) (xy -3.218522 4.316212) (xy -3.253963 4.330372) (xy -3.283988 4.342932)
(xy -3.337323 4.374563) (xy -3.362289 4.391021) (xy -3.467793 4.44054) (xy -3.577921 4.445965) (xy -3.699401 4.407244)
(xy -3.736923 4.388181) (xy -3.816598 4.335623) (xy -3.877095 4.269378) (xy -3.92822 4.184642) (xy -3.967233 4.103793)
(xy -3.994248 4.033183) (xy -4.002865 3.993046) (xy -3.99325 3.95313) (xy -3.966833 3.878645) (xy -3.927258 3.779023)
(xy -3.878167 3.663696) (xy -3.858614 3.619585) (xy -3.804268 3.49458) (xy -3.755572 3.375697) (xy -3.717059 3.274489)
(xy -3.693259 3.202513) (xy -3.689884 3.189332) (xy -3.636359 2.954629) (xy -3.591726 2.763973)
(xy -3.555101 2.613886) (xy -3.525602 2.500889) (xy -3.502346 2.421505) (xy -3.484448 2.372255)
(xy -3.479973 2.362801) (xy -3.455512 2.290155) (xy -3.444903 2.20842) (xy -3.44489 2.205983) (xy -3.427476 2.116383)
(xy -3.375737 2.038245) (xy -3.325931 1.962053) (xy -3.293886 1.877312) (xy -3.291424 1.86468) (xy -3.265955 1.781008)
(xy -3.223021 1.698326) (xy -3.215019 1.686863) (xy -3.164673 1.586953) (xy -3.153773 1.51608) (xy -3.142709 1.437547)
(xy -3.115163 1.350251) (xy -3.105253 1.327886) (xy -3.075549 1.256958) (xy -3.058404 1.197728)
(xy -3.056734 1.182623) (xy -3.046996 1.132227) (xy -3.037322 1.114737) (xy -3.019055 1.081192)
(xy -2.990828 1.016798) (xy -2.962852 0.946131) (xy -2.898884 0.78837) (xy -2.837591 0.658839) (xy -2.782216 0.563781)
(xy -2.736302 0.509681) (xy -2.709359 0.47643) (xy -2.669482 0.413739) (xy -2.627633 0.339449) (xy -2.579348 0.259698)
(xy -2.53473 0.205401) (xy -2.506178 0.1871) (xy -2.465762 0.163783) (xy -2.417747 0.113819) (xy -2.402338 0.092969)
(xy -2.341068 0.020894) (xy -2.267932 -0.043215) (xy -2.256332 -0.051287) (xy -2.18808 -0.108663)
(xy -2.131396 -0.176225) (xy -2.124315 -0.187624) (xy -2.085828 -0.25146) (xy -2.033464 -0.334817)
(xy -1.991686 -0.39951) (xy -1.946461 -0.472489) (xy -1.920591 -0.531276) (xy -1.908934 -0.594921)
(xy -1.906349 -0.682477) (xy -1.90656 -0.714887) (xy -1.919744 -0.918325) (xy -1.953027 -1.137731)
(xy -2.002292 -1.346419) (xy -2.024248 -1.427115) (xy -2.041643 -1.49828) (xy -2.045439 -1.516238)
(xy -2.061531 -1.586543) (xy -2.089571 -1.695427) (xy -2.127465 -1.835026) (xy -2.173118 -1.997477)
(xy -2.181182 -2.025693) (xy -2.34786 -2.677651) (xy -2.481164 -3.349252) (xy -2.577508 -4.021842)
(xy -2.593973 -4.173835) (xy -2.608265 -4.290094) (xy -2.626019 -4.399407) (xy -2.644383 -4.485337)
(xy -2.653229 -4.515331) (xy -2.678864 -4.626164) (xy -2.671294 -4.706192) (xy -2.636604 -4.753083)
(xy -2.580876 -4.764502)
)
(stroke
(width 0)
(type solid)
)
(fill yes)
(layer "F.Cu")
(uuid "1247a093-c056-4ae4-9d03-314ad661c142")
)
(embedded_fonts no)
)
(footprint "Resistor_SMD:R_0603_1608Metric"
(locked yes)
(layer "F.Cu")
@ -8193,7 +8007,7 @@
(at 4.1 -1.25 90)
(size 1.2 0.27)
(layers "F.Cu" "F.Mask" "F.Paste")
(net 62 "backlight_fet")
(net 42 "unconnected-(U4-PB10-Pad21)")
(pinfunction "PB10")
(pintype "unspecified")
(uuid "7e9823b4-5e4f-4346-bd89-f93d913a0470")
@ -8256,7 +8070,7 @@
(at 1.25 -4.1 90)
(size 0.27 1.2)
(layers "F.Cu" "F.Mask" "F.Paste")
(net 42 "unconnected-(U4-PB15-Pad28)")
(net 62 "backlight_fet")
(pinfunction "PB15")
(pintype "unspecified")
(uuid "a069a5f1-68ad-46ff-86b9-7595c6f139b6")
@ -25055,6 +24869,14 @@
(net 1)
(uuid "241c2dab-cd22-4d6a-89b6-22a5e33d2a5e")
)
(segment
(start 166.658349 118.253643)
(end 166.658349 117.969587)
(width 0.25)
(layer "F.Cu")
(net 1)
(uuid "283299db-74f2-4ee7-bfc3-193a57a4e2d8")
)
(segment
(start 167.753529 90.00238)
(end 169.66673 90.00238)
@ -25287,14 +25109,6 @@
(net 1)
(uuid "81843990-5035-49e2-b547-16ce5caeefd9")
)
(segment
(start 166.658349 118.253643)
(end 165.351439 118.253643)
(width 0.25)
(layer "F.Cu")
(net 1)
(uuid "8bac4033-b5b2-4b91-bcb6-4ff7f70e7d23")
)
(segment
(start 174.240878 125.643287)
(end 173.978553 125.380962)
@ -25319,6 +25133,14 @@
(net 1)
(uuid "986b5b66-720e-4c51-8152-6f4e81c554f3")
)
(segment
(start 166.658349 117.969587)
(end 167.264504 117.363432)
(width 0.25)
(layer "F.Cu")
(net 1)
(uuid "9bef231d-dec2-41b0-bffd-f832c3463e06")
)
(segment
(start 183.488159 120.535261)
(end 182.290644 120.535261)
@ -25455,14 +25277,6 @@
(net 1)
(uuid "dddbfa09-71cb-41c3-a08f-b85a7bafd170")
)
(segment
(start 165.351439 118.253643)
(end 165.338703 118.240907)
(width 0.25)
(layer "F.Cu")
(net 1)
(uuid "dde48b5c-1003-4c3c-9a94-3c47cc6c40fd")
)
(segment
(start 183.584442 122.41021)
(end 182.194361 122.41021)
@ -25851,7 +25665,7 @@
(uuid "f183a198-88d5-4f90-bb01-a652fdebec66")
)
(via
(at 165.338703 118.240907)
(at 167.264504 117.363432)
(size 0.6)
(drill 0.3)
(layers "F.Cu" "B.Cu")
@ -25903,22 +25717,6 @@
(net 2)
(uuid "03834c81-0095-40b1-9c46-e9b6295fe263")
)
(segment
(start 166.258642 116.553306)
(end 163.966401 114.261065)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "0ae1e4d8-ddbf-47c4-8a8a-17591ea25479")
)
(segment
(start 154.768188 111.552065)
(end 154.768188 111.060065)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "0b556550-0145-4196-b78e-41d37f1c9610")
)
(segment
(start 154.768188 113.2016)
(end 154.768188 111.060065)
@ -25959,6 +25757,14 @@
(net 2)
(uuid "0e4c310f-42a5-4020-bbb7-4ec7e3e78d0f")
)
(segment
(start 154.768188 112.493656)
(end 154.768188 111.060065)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "10df18b1-1823-4450-8b8f-28b3ea010905")
)
(segment
(start 169.68376 119.649239)
(end 169.240878 119.206358)
@ -25983,14 +25789,6 @@
(net 2)
(uuid "1faf8183-8850-48ce-a150-40e5ed902476")
)
(segment
(start 174.559466 103.335534)
(end 173.057466 103.335534)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "2764be3b-c99e-4c3e-bde5-9c5d83453732")
)
(segment
(start 218.951133 113.132201)
(end 220.177133 114.358201)
@ -26015,6 +25813,14 @@
(net 2)
(uuid "345fd647-8060-4b6e-9a5a-1ccddfeb7547")
)
(segment
(start 165.208812 115.503476)
(end 158.335741 115.503476)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "34bae3ee-870c-41d7-a86a-447b7aca5942")
)
(segment
(start 169.240878 118.284125)
(end 168.238831 118.284125)
@ -26039,14 +25845,6 @@
(net 2)
(uuid "3e9b01ba-0b30-4fb5-bdc7-73ed752d1648")
)
(segment
(start 174.559466 103.335534)
(end 201.621133 103.335534)
(width 0.25)
(layer "F.Cu")
(net 2)
(uuid "4606ecea-7c40-4cfd-941a-b7e962d23c8b")
)
(segment
(start 212.177133 105.891534)
(end 212.177133 111.906201)
@ -26071,6 +25869,14 @@
(net 2)
(uuid "4c595bcf-a167-4bb3-812e-5a824d57ca09")
)
(segment
(start 202.951133 104.665534)
(end 174.629466 104.665534)
(width 0.25)
(layer "F.Cu")
(net 2)
(uuid "4c7fecd7-4cfb-4fa9-aa7d-6c0e643f1b83")
)
(segment
(start 194.951133 113.132201)
(end 202.951133 113.132201)
@ -26087,6 +25893,14 @@
(net 2)
(uuid "59a56cfa-ff5a-4369-aee4-6bfc3241438f")
)
(segment
(start 174.559466 104.735534)
(end 173.057466 104.735534)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "60ac87e8-a1d3-4811-ac37-85c7e387b87a")
)
(segment
(start 157.473188 106.860065)
(end 155.860688 106.860065)
@ -26103,6 +25917,22 @@
(net 2)
(uuid "66349c56-0e29-47f0-ba6b-b8d846e802ec")
)
(segment
(start 165.621235 115.915899)
(end 166.258642 116.553306)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "69aef433-6f57-4454-872b-76abf1a6455c")
)
(segment
(start 165.621235 115.915899)
(end 165.208812 115.503476)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "6b899ded-d509-4731-9696-7f270535c9d9")
)
(segment
(start 174.740878 126.784125)
(end 174.740878 123.650545)
@ -26127,6 +25957,14 @@
(net 2)
(uuid "75be30e1-3b1e-4ea3-ad2e-de3c43073fad")
)
(segment
(start 154.768188 111.060065)
(end 154.768188 111.935923)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "79c595e2-3a80-4c6f-8b44-160f986db52c")
)
(segment
(start 202.951133 104.665534)
(end 210.951133 104.665534)
@ -26143,6 +25981,22 @@
(net 2)
(uuid "802d5d8c-4487-4aaf-baa6-e055b6f5362e")
)
(segment
(start 165.610084 115.92705)
(end 165.621235 115.915899)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "82a4d107-aec8-4318-a670-8a75c0003514")
)
(segment
(start 154.768188 111.935923)
(end 158.335741 115.503476)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "84f75845-f44d-46a5-b604-15ca5039771c")
)
(segment
(start 174.173724 128.478655)
(end 174.740878 127.911501)
@ -26151,22 +26005,6 @@
(net 2)
(uuid "86633816-49de-47b4-b383-27a00b420b7d")
)
(segment
(start 154.768188 111.060065)
(end 154.768188 112.310065)
(width 0.25)
(layer "F.Cu")
(net 2)
(uuid "8b60d41f-3fdc-49bd-a41e-97067c40f190")
)
(segment
(start 172.210188 104.182812)
(end 172.210188 106.017278)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "8dcbddeb-9667-413c-a34d-110efece3d3c")
)
(segment
(start 174.173724 128.478655)
(end 174.319008 128.478655)
@ -26175,14 +26013,6 @@
(net 2)
(uuid "90786260-dfaf-4b27-b599-2efb1a21d17c")
)
(segment
(start 172.210188 105.484812)
(end 172.210188 106.017278)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "92d84022-5acc-412a-b239-41e246caf52e")
)
(segment
(start 199.11662 129.933381)
(end 175.773734 129.933381)
@ -26231,14 +26061,6 @@
(net 2)
(uuid "a6fa194f-9073-420a-a8ee-318b8c3b6a64")
)
(segment
(start 174.559466 104.735534)
(end 172.959466 104.735534)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "a9324303-59a0-41d5-a513-be81e9842960")
)
(segment
(start 169.240878 117.180573)
(end 168.613611 116.553306)
@ -26272,28 +26094,12 @@
(uuid "b011f6be-d219-4923-b240-1e1b40ec3930")
)
(segment
(start 172.959466 104.735534)
(end 172.210188 105.484812)
(start 173.057466 104.735534)
(end 165.208812 112.584188)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "b6bb591b-d56b-406c-82d4-c69e319a8335")
)
(segment
(start 163.966401 114.261065)
(end 157.477188 114.261065)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "b6d95223-5406-42eb-b6ef-1e960384ec4f")
)
(segment
(start 172.210188 106.017278)
(end 163.966401 114.261065)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "bac38b61-df5c-47ad-b5cd-aec43687fb16")
(uuid "b8a9e12e-c709-441d-a41c-566bf64327bd")
)
(segment
(start 153.498188 109.790065)
@ -26311,6 +26117,22 @@
(net 2)
(uuid "bd079f40-841b-46dc-98c0-aef0e38e27c4")
)
(segment
(start 165.208812 112.584188)
(end 165.208812 115.503476)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "bdb98011-3b9c-4d97-bc8d-c49308b7b006")
)
(segment
(start 174.629466 104.665534)
(end 174.559466 104.735534)
(width 0.25)
(layer "F.Cu")
(net 2)
(uuid "c0d65d2a-a4d6-43b0-ae84-107aa4ed0628")
)
(segment
(start 146.357799 110.915534)
(end 146.357799 102.915534)
@ -26359,14 +26181,6 @@
(net 2)
(uuid "d60c7641-e943-410a-b11f-3db578a8eae0")
)
(segment
(start 157.477188 114.261065)
(end 154.768188 111.552065)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "d7fa6fd2-fd08-41ba-b86c-1e507a648f3e")
)
(segment
(start 169.240878 118.284125)
(end 169.240878 119.206358)
@ -26407,22 +26221,6 @@
(net 2)
(uuid "e666a58c-5a79-4ac0-8cda-7886e00bbee5")
)
(segment
(start 173.057466 103.335534)
(end 172.210188 104.182812)
(width 0.5)
(layer "F.Cu")
(net 2)
(uuid "f1c7b78c-52b3-4c41-b52d-3a6a5cd4daae")
)
(segment
(start 201.621133 103.335534)
(end 202.951133 104.665534)
(width 0.25)
(layer "F.Cu")
(net 2)
(uuid "f8169c98-9c13-459b-8ab1-7f061c71fe6a")
)
(segment
(start 202.951133 126.098868)
(end 210.951133 126.098868)
@ -27280,12 +27078,28 @@
(uuid "1219143e-78dc-4702-ae97-b317624f389e")
)
(segment
(start 163.341804 117.129306)
(end 155.935429 117.129306)
(start 156.309173 117.50305)
(end 152.037231 113.231108)
(width 0.25)
(layer "F.Cu")
(net 25)
(uuid "4091f1ad-f99c-410b-bfab-8a899dd98373")
(uuid "26d2e6cc-17d1-4365-a55c-4bcd05d41df2")
)
(segment
(start 165.996623 119.784125)
(end 163.715548 117.50305)
(width 0.25)
(layer "F.Cu")
(net 25)
(uuid "40f2746f-7390-42c8-935c-5f05ad6cfbbf")
)
(segment
(start 163.715548 117.50305)
(end 156.309173 117.50305)
(width 0.25)
(layer "F.Cu")
(net 25)
(uuid "4d229c48-0ff8-4cb3-8049-f2bd3d047ccd")
)
(segment
(start 152.037231 101.976085)
@ -27295,14 +27109,6 @@
(net 25)
(uuid "4eb6f40d-fabb-413e-b451-c85575e97a20")
)
(segment
(start 165.996623 119.784125)
(end 163.341804 117.129306)
(width 0.25)
(layer "F.Cu")
(net 25)
(uuid "88bbea9a-e0c3-4b2b-8168-f94cf9695c0d")
)
(segment
(start 151.444748 101.383602)
(end 147.313909 101.383602)
@ -27319,14 +27125,6 @@
(net 25)
(uuid "9c15adfb-634b-4f9f-8528-95fae93cd7bb")
)
(segment
(start 155.935429 117.129306)
(end 152.037231 113.231108)
(width 0.25)
(layer "F.Cu")
(net 25)
(uuid "a1ea3df5-caef-4cdb-bbb4-a6979714ad9e")
)
(segment
(start 144.950255 97.524097)
(end 144.950255 99.019948)
@ -27343,6 +27141,30 @@
(net 25)
(uuid "ffc3663c-da28-4a55-b1bc-afc335d5f682")
)
(segment
(start 173.057466 103.335534)
(end 173.983466 103.335534)
(width 0.5)
(layer "F.Cu")
(net 32)
(uuid "6c5a2c69-59df-41de-b210-6ff05e64e890")
)
(segment
(start 160.210741 114.553476)
(end 161.839524 114.553476)
(width 0.5)
(layer "F.Cu")
(net 32)
(uuid "f66b29a8-9bf5-4a19-9467-70769b9fefe5")
)
(segment
(start 161.839524 114.553476)
(end 173.057466 103.335534)
(width 0.5)
(layer "F.Cu")
(net 32)
(uuid "f7a30b63-a13a-46e0-a975-668f2cdc7650")
)
(segment
(start 173.307466 107.535534)
(end 174.559466 107.535534)
@ -27551,6 +27373,62 @@
(net 61)
(uuid "e51d7840-1c29-4e07-9ca6-3371114c25e5")
)
(segment
(start 168.777878 121.284125)
(end 167.890878 121.284125)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "44077575-7aad-41de-ae89-0f59025a8cf5")
)
(segment
(start 163.597716 116.453476)
(end 166.467365 119.323125)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "4e463f7e-705d-43b0-b1ab-6d33dd1c782e")
)
(segment
(start 166.467365 119.323125)
(end 168.719835 119.323125)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "501f9b39-96d3-4e25-8ba7-edaeb557a44f")
)
(segment
(start 168.719835 119.323125)
(end 169.23276 119.83605)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "67fefe55-844e-44b6-b515-cbcaeb80d9b8")
)
(segment
(start 160.210741 116.453476)
(end 163.597716 116.453476)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "abe754a0-9398-4ee7-a082-f662052efb4d")
)
(segment
(start 169.23276 120.829243)
(end 168.777878 121.284125)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "ae7127cc-5e7f-402b-9890-fbb02a22c94a")
)
(segment
(start 169.23276 119.83605)
(end 169.23276 120.829243)
(width 0.25)
(layer "F.Cu")
(net 62)
(uuid "c432c430-a203-47b3-86e0-fc37d9167ea8")
)
(zone
(net 1)
(net_name "GND")

View File

@ -1,7 +1,7 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"active_layer": 2,
"active_layer_preset": "Back Layers",
"auto_track_width": true,
"hidden_netclasses": [],
"hidden_nets": [],
@ -48,7 +48,7 @@
"conflict_shadows",
"shapes"
],
"visible_layers": "00000000_00000000_00000008_82082227",
"visible_layers": "00000000_00000000_00000002_2200888c",
"zone_display_mode": 1
},
"git": {

View File

@ -5020,22 +5020,22 @@
)
(global_label "backlight_fet"
(shape input)
(at 144.78 86.36 180)
(at 187.96 86.36 0)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(justify left)
)
(uuid "0ce962d2-d7a6-4fbc-ac94-cf81640d341f")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 129.5788 86.36 0)
(at 203.1612 86.36 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(justify left)
(hide yes)
)
)

View File

@ -1,22 +1,197 @@
ptype render_mandelbrot:cam
ptype render_mandelbrot:camera
set draw_mandelbrot:cam
set draw_mandelbrot()::cam
draw_mandelbrot()::cam
print $3
ptype $3
bruh = 1
set bruh = 1
set $bruh = 1
set $bruh = {
min_r = -1,
min_i = -0.5,
max_r = 1,
max_i = 0.5
}
set $bruh = {1, 2, 3, 4}
bruh
print $bruh
set draw_mandelbrot()::cam
set draw_mandelbrot()::cam = $bruh
set draw_mandelbrot()::cam.min_r = -2
set draw_mandelbrot()::cam
set draw_mandelbrot()::cam = 0
set draw_mandelbrot()::cam = {0}
print $bruh
print draw_mandelbrot()::cam
print draw_mandelbrot()::cam
set draw_mandelbrot()::cam = {
min_r = 0,
min_i = 0,
max_r = 0,
max_i = 0
}
set draw_mandelbrot()::cam = {0, 0, 0, 0}
set draw_mandelbrot()::cam = {0, 1, 2, 3}
print draw_mandelbrot()::cam
bruh
print $bruh
set draw_mandelbrot()::cam = bruh
set draw_mandelbrot()::cam = $bruh
set bruh = draw_mandelbrot()::cam
set $bruh = draw_mandelbrot()::cam
print $bruh
set draw_mandelbrot()::cam = $bruh
bruh = { asdf = 0 }
set $bruh = { asdf = 0 }
set $bruh = { min_r = 0 }
print bruh
print bruh
print $bruh
bruh.min_r
set $bruh.min_r = 1
set #bruh
print $bruh
set draw_mandelbrot()::cam = $bruh
print draw_mandelbrot()::cam
print $bruh[0]
print $bruh
set $bruh = {$bruh, $bruh}
bruh
print $bruh
print $bruh[0]
print $bruh[1]
load
c
print wait_time
c
print draw_mandelbrot()::cam
set $asdf = {
min_r = -1,
min_i = -0.5,
max_r = 1,
max_i = 0.5
}
set $bruh = {
min_r = -1,
min_i = -0.5,
max_r = 1,
max_i = 0.5
}
set $bruh[0] = {
min_r = -1,
min_i = -0.5,
max_r = 1,
max_i = 0.5
}
set $bruh[0] = {
.min_r = -1,
min_i = -0.5,
max_r = 1,
max_i = 0.5
}
print camera
print *cam
print draw_mandelbrot()::cam
c
quit
d
c
quit
c
quit
c
load
c
print *cam
print draw_mandelbrot()::cam
x
c
print draw_mandelbrot()::cam
c
load
c
print draw_mandelbrot()::cam
printf "%1.20f\n" draw_mandelbrot()::cam
printf "%1.20f\n", draw_mandelbrot()::cam.min_i
printf "%1.20f\n", draw_mandelbrot()::cam.max_r
print 3
print -1.4054856689592869e-05
for
while
exit
quit
len(vi
len(vi)
quit
quit
quit
quit
command render_mandelbrot(0xff)
c
command render_mandelbrot(0xff)
c
quit
c
quit
quit
quit
print render_mandelbrot
quit
quit
c
set draw_mandelbrot()::view_mode 0
set draw_mandelbrot()::view_mode = 0
quit
quit
load
c
quit
load
context
c
print time
b st7735.c:104
c
quit
disp benchmark_stop:time
disp benchmark_stop.time
disp benchmark_stop()::time
quit
quit
quit
exit
quit
quit
quit
c
c
load
quit
c
load
load
exit
load
c
quit
b st7735.c:102
quit
quit
quit
load
c
b mandelbrot.c:102
c
c
c
c
c
c
c
load
c
quit
info b
b render_mandelbrot
c
c
c
c
c
c
@ -25,232 +200,57 @@ c
c
c
quit
load
c
print time
quit
load
c
print time
quit
load
c
quit
quit
reload
load
b render_mandelbrot
c
context
quit
quit
load
c
load
c
quit
load
c
quit
load
c
f 2
f 4
f 5
next
context
f 6
p sizeof(bool)
p sizeof(uint16_t)
context
f 5
print bruh
print &bruh
print &framebuffer
context
quit
load
c
f 2
f 3
context
quit
load
context
c
p time
c
quit
load
c
p time
quit
load
c
p time
quit
load
c
p time
quit
quit
c
load
c
p time
quit
c
load
c
quit
quit
load
c
b st7735.c:320
b ST7735.c:320
b ST7735.c:320
c
load
c
quit
b ST7735.c:320
load
c
c
c
p time
b ST7735_DrawImage
c
p x
p y
c
quit
load
c
p time
b ST7735_DrawImage
c
p x
x y
p y
p x
c
f 4
c
quit
load
c
load
b ST7735_DrawImage
c
p x
p y
c
p x
p y
p h
p y
p h
quit
load
c
p time
c
f 2
f 1
print &framebuffer
context
p &view_mode
print bottom_buffered
print &bottom_buffered
print &bottom_buffered
print &view_mode
f 0
print bruh
print &bruh
print &bruh
exit
load
quit
quit
c
quit
c
b render_mandelbrot
c
c
d
b 80012d0
b 0x80012d0
b *0x80012d0
c
next
next
quit
load
reg
p _sbss
p (uintptr_32)_sbss
p/x_sbss
p/x _sbss
p (void *)_sbss
p (void)_sbss
p (void *)&_sbss
p (void *)&__bss_start__
p sp
reg
c
p itme
p time
d
c
c
print uwTick
c
print tickstart
print wait
quit
load
c
c
c
quit
load
c
quit
quit
load
c
load
c
quit
load
c
quit
load
c
p time
c
quit
load
c
c
quit
load
c
quitr
quit
load
c
quit
c
load
c
c
load
c
p time
quit
load
c
p time
quit
c
p itme
p time
quit
load
c
p time
quit
c
qquit
quit
load
c
p itme
p time
c
quit
load
c
quit
load
c
p itme
p time
quit
load
quit
load
c
quit
quit
c
load
c
b 153
b mandelbrot.c:153
c
p colorscheme
quit
load
c
quit

View File

@ -2,14 +2,6 @@
#include <signal.h>
#include "main.h"
static float time __attribute__((used));
__attribute__((always_inline)) void static inline benchmark_start() {
TIM4->CNT = 0;
TIM4->CR1 |= TIM_CR1_CEN;
}
__attribute__((always_inline)) void static inline benchmark_stop() {
TIM4->CR1 ^= TIM_CR1_CEN;
time = (float)(TIM4->CNT + 1) * (TIM4->PSC + 1) / HAL_RCC_GetSysClockFreq();
__BKPT();
}
void benchmark_start();
void benchmark_stop();

View File

@ -31,7 +31,6 @@ extern "C" {
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
@ -59,6 +58,14 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
/* USER CODE BEGIN Private defines */
#define GPIO_BUTTON_REG GPIOB
#define BUTTON_UP GPIO_PIN_3
#define BUTTON_RIGHT GPIO_PIN_2
#define BUTTON_DOWN GPIO_PIN_0
#define BUTTON_LEFT GPIO_PIN_1
#define BUTTON_A GPIO_PIN_13
#define BUTTON_B GPIO_PIN_14
/* USER CODE END Private defines */

View File

@ -9,16 +9,3 @@ enum states {
};
void draw_mandelbrot(int key_pressed);
/** the interrupt handler should read the pin pressed, then translate it into one of these.
* Ensures that if we have to change pins, adjustments are easy.
*/
enum buttons {
KEYCODE_UP,
KEYCODE_RIGHT,
KEYCODE_DOWN,
KEYCODE_LEFT,
KEYCODE_A,
KEYCODE_B,
//we need to call the function once during boot
KEYCODE_NONE = 0xff
};

View File

@ -0,0 +1,16 @@
#include <signal.h>
#include "main.h"
static float time __attribute__((used));
void benchmark_start() {
TIM4->CNT = 0;
TIM4->CR1 |= TIM_CR1_CEN;
}
void benchmark_stop() {
TIM4->CR1 ^= TIM_CR1_CEN;
time = (float)(TIM4->CNT + 1) * (TIM4->PSC + 1) / HAL_RCC_GetSysClockFreq();
BENCHMARK_CHECKTIME:
__NOP();
// __BKPT();
}

View File

@ -70,13 +70,6 @@ static void MX_TIM4_Init(void);
//when idling, vreg stop mode, low power mode stop
//when sleeping, vreg stop mode, low power mode standby (RTC alarm)
#define GPIO_UP GPIO_PIN_3
#define GPIO_RIGHT GPIO_PIN_1
#define GPIO_DOWN GPIO_PIN_0
#define GPIO_LEFT GPIO_PIN_2
#define GPIO_A GPIO_PIN_13
#define GPIO_B GPIO_PIN_14
#define GPIO_BUTTON_REG GPIOB
bool button_event;
@ -85,35 +78,12 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim) {
button_event = false;
}
int button_pressed = KEYCODE_NONE;
int button_pressed = 0;
bool button_event;
void HAL_GPIO_EXTI_Callback(uint16_t pin) {
button_event = true;
//we can write "modules" that don't need to know the specific pins to know hwat button was pressed
//(idk why I felt I needed to do this)
switch(pin) {
case GPIO_UP:
button_pressed = KEYCODE_UP;
break;
case GPIO_RIGHT:
button_pressed = KEYCODE_RIGHT;
break;
case GPIO_DOWN:
button_pressed = KEYCODE_DOWN;
break;
case GPIO_LEFT:
button_pressed = KEYCODE_LEFT;
break;
case GPIO_A:
button_pressed = KEYCODE_A;
break;
case GPIO_B:
button_pressed = KEYCODE_B;
break;
default:
button_pressed = KEYCODE_NONE;
}
button_pressed = pin;
}
/* USER CODE END 0 */
@ -133,7 +103,7 @@ int main(void)
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USE CODE BEGIN Init */
/* USER CODE END Init */
@ -155,31 +125,22 @@ int main(void)
//ST7735_FillScreenFast(ST7735_MAGENTA);
//HAL_GPIO_EXTI_Callback(0xff);
benchmark_start();
draw_mandelbrot(button_pressed);
benchmark_stop();
BENCHMARK_INIT: //for benchmarking gdb script
HAL_SuspendTick();
HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);
//HAL_SuspendTick();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
/**
ST7735_sleep();
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
**/
//we'll clean everything up later
while (1)
{
//later we'll impliment menu
if(button_event) {
button_event = false;
HAL_ResumeTick();
HAL_TIM_Base_Stop_IT(&htim2);
draw_mandelbrot(button_pressed);
HAL_TIM_Base_Stop_IT(&htim2);
HAL_SuspendTick();
__HAL_TIM_SET_COUNTER(&htim2, 0);
HAL_TIM_Base_Start_IT(&htim2);
@ -187,7 +148,7 @@ int main(void)
HAL_ResumeTick();
}
else { //zzzzz
ST7735_sleep();
//ST7735_sleep();
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
SystemClock_Config();

View File

@ -1,7 +1,9 @@
#include <stdint.h>
#include <string.h>
#include "mandelbrot.h"
#include "st7735.h"
#include "benchmark.h"
#include "main.h"
#define RES_X 160
#define RES_Y 80
@ -10,7 +12,7 @@
#define STEP_SIZE .1
#define ZOOM_SIZE .1
#define DECIMAL_LOC 28 //TODO see if you can optimize without DSP module
#define DECIMAL_LOC 28
#define DOUBLE_SCALER (1 << DECIMAL_LOC)
#define DOUBLE_TO_FIXED(val) (int32_t)((val) * DOUBLE_SCALER)
#define FIXED_MULTIPLY(x,y) ((((uint64_t)(x))*(y)) >> DECIMAL_LOC)
@ -31,6 +33,14 @@
#define CAM_DEF_MIN_R -1
#define CAM_DEF_MAX_R 1
//set controls
#define CAM_MOVE_UP BUTTON_UP
#define CAM_MOVE_RIGHT BUTTON_RIGHT
#define CAM_MOVE_DOWN BUTTON_DOWN
#define CAM_MOVE_LEFT BUTTON_LEFT
#define CAM_ZOOM_IN BUTTON_A
#define CAM_ZOOM_OUT BUTTON_B
struct camera {
double min_r, min_i, max_r, max_i;
};
@ -75,18 +85,32 @@ void cam_zoom(struct camera *cam, double zoom) {
cam->max_r -= r_scale;
}
//TODO look into border tracing; this is too slow
void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct camera cam, bool half) {
//TODO look into border tracing; this is too slow. Change name
//
void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct camera cam, int x0, int y0, int w, int h) {
int32_t scale_i = DOUBLE_TO_FIXED((cam.max_i - cam.min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam.max_r - cam.min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED(half ? ((cam.max_i - cam.min_i) / 2) + cam.min_i : (cam.max_i));
int32_t c_r, z_i, z_r, zn_r;
int32_t z_r_2, z_i_2;
int32_t c_i = DOUBLE_TO_FIXED((((cam.max_i - cam.min_i) * (RES_Y - y0)) / RES_Y) + cam.min_i);
int32_t c_r0 = DOUBLE_TO_FIXED((((cam.max_r - cam.min_r) * x0) / RES_X) + cam.min_r);
int32_t c_r, z_i, z_r, zn_r, z_r_2, z_i_2;
size_t fb_index = 0;
int i;
for(int y = 0; y < (RES_Y/2); y++) {
c_r = DOUBLE_TO_FIXED(cam.min_r);
for(int x = 0; x < RES_X; x++) {
/**
bool bruh[RES_X * (RES_Y/2)];
for(size_t i = 0; i < sizeof(bruh) / sizeof(bruh[0]); i++) {
bruh[i] = i % 1;
}
for(size_t i = sizeof(bruh) / sizeof(bruh[0]); i > 0; i--) {
framebuffer[i] = bruh[i];
}
**/
for(int y = y0; y < y0 + h; y++) {
c_r = c_r0;
for(int x = x0; x < x0 + w; x++) {
z_i = 0;
z_r = 0;
for(i = 0; i < ITERS; i++) {
@ -95,7 +119,6 @@ void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct came
zn_r = z_r_2 - z_i_2 + c_r;
//z_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + c_i;
z_i = (FIXED_MULTIPLY(z_r, z_i) << 1) + c_i;
z_r = zn_r;
@ -103,7 +126,6 @@ void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct came
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) break;
}
framebuffer[fb_index++] = colorscheme[i];
// ST7735_DrawPixel(x, y, colorscheme[i]);
c_r += scale_r;
}
c_i -= scale_i;
@ -112,49 +134,97 @@ void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct came
#define FB_SIZE_X RES_X
#define FB_SIZE_Y RES_Y/2
//TODO rename
void draw_mandelbrot(int key_pressed) {
uint16_t framebuffer[(RES_X * RES_Y) / 2];
static uint16_t framebuffer[FB_SIZE_X * FB_SIZE_Y];
uint16_t columnbuffer[8*RES_Y];
static bool bottom_buffered = true;
//program flow is awful atm becuase I was planning something different; will be improved soon.
static struct camera cam = {
.min_r = CAM_DEF_MIN_R,
.max_r = CAM_DEF_MAX_R,
.min_i = ((double)RES_Y / RES_X) * CAM_DEF_MIN_R,
.max_i = ((double)RES_Y / RES_X) * CAM_DEF_MAX_R,
};
static int view_mode = VIEW_UNINIT;
static uint16_t colorscheme[ITERS];
//yes, I know the following is disgusting. Before I clean it, I just wanna get the general idea out,
//it's more efficient in that order
//TODO once you get your idea ironed out, clean the code and improve the flow
benchmark_start();
if(view_mode == VIEW_UNINIT) {
view_mode = VIEW_MANDREL;
init_colorscheme_mandrel(colorscheme);
render_mandelbrot(framebuffer, colorscheme, cam, 0, 0, RES_X, RES_Y/2);
ST7735_DrawImage(0, 0, RES_X, (RES_Y / 2), framebuffer);
render_mandelbrot(framebuffer, colorscheme, cam, 0, RES_Y/2, RES_X, RES_Y/2);
ST7735_DrawImage(0, (RES_Y / 2), RES_X, (RES_Y / 2), framebuffer);
bottom_buffered = true;
}
else {
const int y_offset = STEP_SIZE * RES_Y;
const int x_offset = STEP_SIZE * RES_X;
const size_t bottom_space = RES_X * ((RES_Y/2) - y_offset) * sizeof(uint16_t);
uint16_t top_line = bottom_buffered ? (RES_Y/2) : 0;
switch(key_pressed) {
case BUTTON_UP:
cam_shift(&cam, 0, STEP_SIZE);
memmove(framebuffer + (RES_X * y_offset), framebuffer, bottom_space);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, y_offset);
break;
case BUTTON_DOWN:
uint16_t bottom_line = (bottom_buffered ? RES_Y : (RES_Y/2)) - y_offset;
cam_shift(&cam, 0, -STEP_SIZE);
memmove(framebuffer, framebuffer + (RES_X * y_offset), bottom_space);
render_mandelbrot(framebuffer + (RES_X*((RES_Y/2)-y_offset)), colorscheme, cam, 0, bottom_line, RES_X, y_offset);
break;
case BUTTON_RIGHT:
cam_shift(&cam, STEP_SIZE, 0);
render_mandelbrot(columnbuffer, colorscheme, cam, RES_X - x_offset, top_line, x_offset, RES_Y/2);
for(uint16_t y = 0; y < RES_Y/2; y++) {
memmove(framebuffer + (RES_X * y), framebuffer + (RES_X * y) + x_offset, (RES_X - x_offset) * sizeof(*framebuffer));
memmove(framebuffer + (RES_X * y) + (RES_X - x_offset), columnbuffer + (x_offset * y), x_offset * sizeof(*framebuffer));
}
break;
case BUTTON_LEFT:
cam_shift(&cam, -STEP_SIZE, 0);
render_mandelbrot(columnbuffer, colorscheme, cam, 0, top_line, x_offset, RES_Y/2);
for(uint16_t y = 0; y < RES_Y/2; y++) {
memmove(framebuffer + (RES_X * y) + x_offset, framebuffer + (RES_X * y), (RES_X - x_offset) * sizeof(*framebuffer));
memmove(framebuffer + (RES_X * y), columnbuffer + (x_offset * y), x_offset * sizeof(*framebuffer));
}
break;
case BUTTON_A:
cam_zoom(&cam, ZOOM_SIZE);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
break;
case BUTTON_B:
cam_zoom(&cam, -ZOOM_SIZE);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
break;
default:
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
}
ST7735_DrawImage(0, top_line, RES_X, (RES_Y/2), framebuffer);
switch(key_pressed) {
case KEYCODE_UP:
cam_shift(&cam, 0, STEP_SIZE);
break;
case KEYCODE_DOWN:
cam_shift(&cam, 0, -STEP_SIZE);
break;
case KEYCODE_RIGHT:
cam_shift(&cam, -STEP_SIZE, 0);
break;
case KEYCODE_LEFT:
cam_shift(&cam, STEP_SIZE, 0);
break;
case KEYCODE_A:
cam_zoom(&cam, ZOOM_SIZE);
break;
case KEYCODE_B:
cam_zoom(&cam, -ZOOM_SIZE);
break;
default:
bottom_buffered = !bottom_buffered;
top_line = bottom_buffered ? (RES_Y/2) : 0;
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
ST7735_DrawImage(0, top_line, RES_X, (RES_Y/2), framebuffer);
}
render_mandelbrot(framebuffer, colorscheme, cam, false);
benchmark_stop();
/**
render_mandelbrot(framebuffer, colorscheme, cam, false, key_pressed);
ST7735_DrawImage(0, 0, ST7735_WIDTH, (ST7735_HEIGHT / 2), framebuffer);
render_mandelbrot(framebuffer, colorscheme, cam, true);
render_mandelbrot(framebuffer, colorscheme, cam, true, key_pressed);
ST7735_DrawImage(0, (ST7735_HEIGHT / 2), ST7735_WIDTH, (ST7735_HEIGHT / 2), framebuffer);
**/
// ST7735_DrawImage(0, 0, ST7735_WIDTH - 1, ST7735_HEIGHT - 1, (uint16_t *)0x80000000);
}

View File

@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [4.5.0-RC5] date: [Sat May 10 22:32:07 CDT 2025]
# File automatically-generated by tool: [projectgenerator] version: [4.5.0-RC5] date: [Tue May 13 23:21:12 CDT 2025]
##########################################################################################################################
# ------------------------------------------------
@ -37,7 +37,14 @@ BUILD_DIR = build
# C sources
C_SOURCES = \
Core/Src/main.c \
Core/Src/benchmark.c \
Core/Src/stm32f1xx_it.c \
Core/Src/system_stm32f1xx.c \
Core/Src/sysmem.c \
Core/Src/syscalls.c \
Core/Src/st7735.c \
Core/Src/fonts.c \
Core/Src/mandelbrot.c \
Core/Src/stm32f1xx_hal_msp.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
@ -51,14 +58,8 @@ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
Core/Src/system_stm32f1xx.c \
Core/Src/sysmem.c \
Core/Src/syscalls.c \
Core/Src/st7735.c \
Core/Src/fonts.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
Core/Src/mandelbrot.c
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c
# ASM sources
ASM_SOURCES = \
@ -109,8 +110,8 @@ AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32F103xB
-DSTM32F103xB \
-DUSE_HAL_DRIVER
# AS includes
@ -120,9 +121,9 @@ AS_INCLUDES =
C_INCLUDES = \
-ICore/Inc \
-IDrivers/STM32F1xx_HAL_Driver/Inc \
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
-IDrivers/CMSIS/Include
-IDrivers/CMSIS/Include \
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy
# compile gcc flags
@ -148,7 +149,7 @@ LDSCRIPT = stm32f103c8tx_flash.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -Xlinker --print-memory-usage
# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin

View File

@ -0,0 +1,236 @@
#include <stdint.h>
#include <string.h>
#include "mandelbrot.h"
#include "st7735.h"
#include "benchmark.h"
#include "main.h"
#define RES_X 160
#define RES_Y 80
#define DEFAULT_CENTER_X 0
#define DEFAULT_CENTER_Y 0
#define STEP_SIZE .1
#define ZOOM_SIZE .1
#define DECIMAL_LOC 28
#define DOUBLE_SCALER (1 << DECIMAL_LOC)
#define DOUBLE_TO_FIXED(val) (int32_t)((val) * DOUBLE_SCALER)
#define FIXED_MULTIPLY(x,y) ((((uint64_t)(x))*(y)) >> DECIMAL_LOC)
#define FIXED_TO_DOUBLE(val) ((val) / (double)DOUBLE_SCALER)
#define INFTY 2
#define INFTY_SQR INFTY * INFTY
#define ITERS 255
#define INFTY_SQR_FIXED DOUBLE_TO_FIXED(INFTY_SQR)
//TODO move to some hardware.h or somethin
//channel order: B, G, R
#define R_BITS 5
#define G_BITS 6
#define B_BITS 5
//imaginary axis set automatically
#define CAM_DEF_MIN_R -1
#define CAM_DEF_MAX_R 1
//set controls
#define CAM_MOVE_UP BUTTON_UP
#define CAM_MOVE_RIGHT BUTTON_RIGHT
#define CAM_MOVE_DOWN BUTTON_DOWN
#define CAM_MOVE_LEFT BUTTON_LEFT
#define CAM_ZOOM_IN BUTTON_A
#define CAM_ZOOM_OUT BUTTON_B
struct camera {
double min_r, min_i, max_r, max_i;
};
enum VIEW_MODES { VIEW_UNINIT, VIEW_MANDREL, VIEW_SHIP };
void init_colorscheme_mandrel(uint16_t *scheme) {
uint16_t *tc = scheme;
for(unsigned int i = 0; i < ITERS; i++) {
if((i == 0) || (i == ITERS)) *tc = 0;
else if(i < 128) *tc = (((((i - 64) << 2)+0x1f) & 0x1f) | (((((i - 128) << 1)+0x1f) & 0x1f) << (5+6)));
else *tc = (-2*(i - 128)+0x1f) & 0xff;
*tc = (*tc << 8) | (*tc >> 8); //convert to little endian
tc++;
}
}
void init_colorscheme_ship(uint16_t *scheme) {
uint16_t *tc = scheme;
for(unsigned int i = 0; i < ITERS; i++) {
if((i == 0) || (i == ITERS)) *tc = 0;
else *tc = (((i - (128)) << 1)+0x1f) << (5+6);
tc++;
}
}
void cam_shift(struct camera *cam, double step_r, double step_i) {
double i_offset = (cam->max_i - cam->min_i) * step_i;
double r_offset = (cam->max_r - cam->min_r) * step_r;
cam->min_i += i_offset;
cam->max_i += i_offset;
cam->min_r += r_offset;
cam->max_r += r_offset;
}
void cam_zoom(struct camera *cam, double zoom) {
double i_scale = (cam->max_i - cam->min_i) * zoom;
double r_scale = (cam->max_r - cam->min_r) * zoom;
cam->min_i += i_scale;
cam->max_i -= i_scale;
cam->min_r += r_scale;
cam->max_r -= r_scale;
}
//TODO look into border tracing; this is too slow. Change name
//
void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct camera cam, int x0, int y0, int w, int h) {
int32_t scale_i = DOUBLE_TO_FIXED((cam.max_i - cam.min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam.max_r - cam.min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED((((cam.max_i - cam.min_i) * (RES_Y - y0)) / RES_Y) + cam.min_i);
int32_t c_r0 = DOUBLE_TO_FIXED((((cam.max_r - cam.min_r) * x0) / RES_X) + cam.min_r);
int32_t c_r, z_i, z_r, zn_r, z_r_2, z_i_2;
size_t fb_index = 0;
int i;
//for(;;);
for(int y = y0; y < y0 + h; y++) {
c_r = c_r0;
for(int x = x0; x < x0 + w; x++) {
z_i = 0;
z_r = 0;
for(i = 0; i < ITERS; i++) {
z_r_2 = FIXED_MULTIPLY(z_r, z_r);
z_i_2 = FIXED_MULTIPLY(z_i, z_i);
zn_r = z_r_2 - z_i_2 + c_r;
//z_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + c_i;
z_i = (FIXED_MULTIPLY(z_r, z_i) << 1) + c_i;
z_r = zn_r;
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) break;
}
framebuffer[fb_index++] = colorscheme[i];
c_r += scale_r;
}
c_i -= scale_i;
}
}
#define FB_SIZE_X RES_X
#define FB_SIZE_Y RES_Y/2
//TODO rename
void draw_mandelbrot(int key_pressed) {
static uint16_t framebuffer[FB_SIZE_X * FB_SIZE_Y];
uint16_t columnbuffer[8*RES_Y];
static bool bottom_buffered = true;
//program flow is awful atm becuase I was planning something different; will be improved soon.
static struct camera cam = {
.min_r = CAM_DEF_MIN_R,
.max_r = CAM_DEF_MAX_R,
.min_i = ((double)RES_Y / RES_X) * CAM_DEF_MIN_R,
.max_i = ((double)RES_Y / RES_X) * CAM_DEF_MAX_R,
};
static int view_mode = VIEW_UNINIT;
static uint16_t colorscheme[ITERS];
//we could get rid of this and do some awful bitbashing lol
//but for readability, we shant
//TODO camera moves l/r more then u/d for some reason
/**
if(key_pressed & CAM_MOVE_UP) cam_shift(&cam, 0, STEP_SIZE);
if(key_pressed & CAM_MOVE_DOWN) cam_shift(&cam, 0, -STEP_SIZE);
if(key_pressed & CAM_MOVE_RIGHT) cam_shift(&cam, -STEP_SIZE, 0);
if(key_pressed & CAM_MOVE_LEFT) cam_shift(&cam, STEP_SIZE, 0);
if(key_pressed & CAM_ZOOM_IN) cam_zoom(&cam, ZOOM_SIZE);
if(key_pressed & CAM_ZOOM_OUT) cam_zoom(&cam, -ZOOM_SIZE);
**/
//yes, I know the following is disgusting. Before I clean it, I just wanna get the general idea out,
//it's more efficient in that order
//TODO once you get your idea ironed out, clean the code and improve the flow
benchmark_start();
if(view_mode == VIEW_UNINIT) {
view_mode = VIEW_MANDREL;
init_colorscheme_mandrel(colorscheme);
render_mandelbrot(framebuffer, colorscheme, cam, 0, 0, RES_X, RES_Y/2);
ST7735_DrawImage(0, 0, RES_X, (RES_Y / 2), framebuffer);
render_mandelbrot(framebuffer, colorscheme, cam, 0, RES_Y/2, RES_X, RES_Y/2);
ST7735_DrawImage(0, (RES_Y / 2), RES_X, (RES_Y / 2), framebuffer);
bottom_buffered = true;
}
else {
const int y_offset = STEP_SIZE * RES_Y;
const int x_offset = STEP_SIZE * RES_X;
const size_t bottom_space = RES_X * ((RES_Y/2) - y_offset) * sizeof(uint16_t);
uint16_t top_line = bottom_buffered ? (RES_Y/2) : 0;
switch(key_pressed) {
case BUTTON_UP:
cam_shift(&cam, 0, STEP_SIZE);
memmove(framebuffer + (RES_X * y_offset), framebuffer, bottom_space);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, y_offset);
break;
case BUTTON_DOWN:
uint16_t bottom_line = (bottom_buffered ? RES_Y : (RES_Y/2)) - y_offset;
cam_shift(&cam, 0, -STEP_SIZE);
memmove(framebuffer, framebuffer + (RES_X * y_offset), bottom_space);
render_mandelbrot(framebuffer + (RES_X*((RES_Y/2)-y_offset)), colorscheme, cam, 0, bottom_line, RES_X, y_offset);
break;
case BUTTON_RIGHT:
cam_shift(&cam, STEP_SIZE, 0);
render_mandelbrot(columnbuffer, colorscheme, cam, RES_X - x_offset, top_line, x_offset, RES_Y/2);
for(uint16_t y = 0; y < RES_Y/2; y++) {
memmove(framebuffer + (RES_X * y), framebuffer + (RES_X * y) + x_offset, (RES_X - x_offset) * sizeof(*framebuffer));
memmove(framebuffer + (RES_X * y) + (RES_X - x_offset), columnbuffer + (x_offset * y), x_offset * sizeof(*framebuffer));
}
break;
case BUTTON_LEFT:
cam_shift(&cam, -STEP_SIZE, 0);
render_mandelbrot(columnbuffer, colorscheme, cam, 0, top_line, x_offset, RES_Y/2);
for(uint16_t y = 0; y < RES_Y/2; y++) {
memmove(framebuffer + (RES_X * y) + x_offset, framebuffer + (RES_X * y), (RES_X - x_offset) * sizeof(*framebuffer));
memmove(framebuffer + (RES_X * y), columnbuffer + (x_offset * y), x_offset * sizeof(*framebuffer));
}
break;
case BUTTON_A:
cam_zoom(&cam, ZOOM_SIZE);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
break;
case BUTTON_B:
cam_zoom(&cam, -ZOOM_SIZE);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
break;
default:
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
}
ST7735_DrawImage(0, top_line, RES_X, (RES_Y/2), framebuffer);
bottom_buffered = !bottom_buffered;
top_line = bottom_buffered ? (RES_Y/2) : 0;
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
ST7735_DrawImage(0, top_line, RES_X, (RES_Y/2), framebuffer);
}
benchmark_stop();
/**
render_mandelbrot(framebuffer, colorscheme, cam, false, key_pressed);
ST7735_DrawImage(0, 0, ST7735_WIDTH, (ST7735_HEIGHT / 2), framebuffer);
render_mandelbrot(framebuffer, colorscheme, cam, true, key_pressed);
ST7735_DrawImage(0, (ST7735_HEIGHT / 2), ST7735_WIDTH, (ST7735_HEIGHT / 2), framebuffer);
**/
// ST7735_DrawImage(0, 0, ST7735_WIDTH - 1, ST7735_HEIGHT - 1, (uint16_t *)0x80000000);
}

View File

@ -0,0 +1,52 @@
file build/stm32f1_buisnesscard_v1.elf
target extended localhost:3333
set logging file benchmark.txt
set logging enabled on
set $camtype = draw_mandelbrot()::cam
set $views = {$camtype, $camtype, $camtype, $camtype, $camtype}
# default view; lots of black
set $views[0].min_r = -1
set $views[0].min_i = -.5
set $views[0].max_r = 1
set $views[0].max_i = .5
# noise and complex curves
set $views[1].min_r = 3.1577176569116192
set $views[1].min_i = 0.22066305108751161
set $views[1].max_r = 3.1577882779434727
set $views[1].max_i = 0.22069836160343248
#noise at high iter acount
set $views[2].min_r = 3.1576023402469482
set $views[2].min_i = 0.22069267606110915
set $views[2].max_r = 3.1576029655564359
set $views[2].max_i = 0.22069298871585336
# sub mandelbrot asscrack
set $views[3].min_r = 1.5143340717923357
set $views[3].min_i = -1.4054856689592869e-05
set $views[3].max_r = 1.5143697529846534
set $views[3].max_i = 3.7857394692316253e-06
#set gdb-workaround-stop-event 1
break main:BENCHMARK_INIT
commands
set $vi = 0
while($vi < 4)
print $views[$vi]
set draw_mandelbrot()::cam = $views[$vi]
set draw_mandelbrot()::view_mode = 0
call draw_mandelbrot(0xff)
print benchmark_stop()::time
set $vi = $vi + 1
end
end
load
continue
quit

View File

@ -0,0 +1,531 @@
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 15 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
$1 = {min_r = -1, min_i = -0.5, max_r = 1, max_i = 0.5}
$2 = {min_r = 3.1577176569116192, min_i = 0.22066305108751161, max_r = 3.1577882779434727, max_i = 0.22069836160343248}
$3 = {min_r = 3.1576023402469482, min_i = 0.22069267606110915, max_r = 3.1576029655564359, max_i = 0.22069298871585336}
$4 = {min_r = 1.5143340717923357, min_i = -1.4054856689592869e-05, max_r = 1.5143697529846534, max_i = 3.7857394692316253e-06}
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 15 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
$1 = {min_r = -1, min_i = -0.5, max_r = 1, max_i = 0.5}
$2 = 1.31749451
$3 = {min_r = 3.1577176569116192, min_i = 0.22066305108751161, max_r = 3.1577882779434727, max_i = 0.22069836160343248}
$4 = 0.183570281
$5 = {min_r = 3.1576023402469482, min_i = 0.22069267606110915, max_r = 3.1576029655564359, max_i = 0.22069298871585336}
$6 = 0.217522398
$7 = {min_r = 1.5143340717923357, min_i = -1.4054856689592869e-05, max_r = 1.5143697529846534, max_i = 3.7857394692316253e-06}
$8 = 0.761290252
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 15 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
$1 = {min_r = -1, min_i = -0.5, max_r = 1, max_i = 0.5}
$2 = 1.31749451
$3 = {min_r = 3.1577176569116192, min_i = 0.22066305108751161, max_r = 3.1577882779434727, max_i = 0.22069836160343248}
$4 = 0.183570281
$5 = {min_r = 3.1576023402469482, min_i = 0.22069267606110915, max_r = 3.1576029655564359, max_i = 0.22069298871585336}
$6 = 0.217522398
$7 = {min_r = 1.5143340717923357, min_i = -1.4054856689592869e-05, max_r = 1.5143697529846534, max_i = 3.7857394692316253e-06}
$8 = 0.761290252
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 15 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
$1 = {min_r = -1, min_i = -0.5, max_r = 1, max_i = 0.5}
$2 = 1.31749451
$3 = {min_r = 3.1577176569116192, min_i = 0.22066305108751161, max_r = 3.1577882779434727, max_i = 0.22069836160343248}
$4 = 0.183570281
$5 = {min_r = 3.1576023402469482, min_i = 0.22069267606110915, max_r = 3.1576029655564359, max_i = 0.22069298871585336}
$6 = 0.217522398
$7 = {min_r = 1.5143340717923357, min_i = -1.4054856689592869e-05, max_r = 1.5143697529846534, max_i = 3.7857394692316253e-06}
$8 = 0.761290252
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 15 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
$1 = {min_r = -1, min_i = -0.5, max_r = 1, max_i = 0.5}
$2 = 1.31749451
$3 = {min_r = 3.1577176569116192, min_i = 0.22066305108751161, max_r = 3.1577882779434727, max_i = 0.22069836160343248}
$4 = 0.183570281
$5 = {min_r = 3.1576023402469482, min_i = 0.22069267606110915, max_r = 3.1576029655564359, max_i = 0.22069298871585336}
$6 = 0.217522398
$7 = {min_r = 1.5143340717923357, min_i = -1.4054856689592869e-05, max_r = 1.5143697529846534, max_i = 3.7857394692316253e-06}
$8 = 0.761290252
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
benchmark.gdb:49: Error in sourced command file:
Error erasing flash with vFlashErase packet
------- tip of the day (disable with set show-tips off) -------
The set show-flags on setting will display CPU flags register in the regs context panel
LEGEND: STACK | HEAP | CODE | DATA | WX | RODATA
───────────────[ REGISTERS / show-flags off / show-compact-regs off ]───────────────
R0 0
R1 0x42420000
R2 0x12c0c0
R3 0x4b03
R4 0
R5 0x40021000
R6 0
R7 0x80000000
R8 0xffff
R9 0x1000
R10 0x20000054
R11 0x77bdd31d
R12 0xf8ff
SP 0x20005000
LR 0xffffffff
PC 0x80038e4
──────────────────[ DISASM / armcm / thumb mode / set emulate on ]──────────────────
► 0x80038e4 <Reset_Handler> movs r0, r0
0x80038e6 <Reset_Handler+2> movs r0, r0
0x80038e8 <Reset_Handler+4> movs r0, r0
0x80038ea <Reset_Handler+6> movs r0, r0
0x80038ec <Reset_Handler+8> movs r0, r0
0x80038ee <Reset_Handler+10> movs r0, r0
0x80038f0 <Reset_Handler+12> movs r0, r0
0x80038f2 <Reset_Handler+14> movs r0, r0
0x80038f4 <Reset_Handler+16> movs r0, r0
0x80038f6 <Reset_Handler+18> movs r0, r0
0x80038f8 <Reset_Handler+20> movs r0, r0
─────────────────────────────────[ SOURCE (CODE) ]──────────────────────────────────
In file: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/startup_stm32f103xb.s:64
59 .weak Reset_Handler
60 .type Reset_Handler, %function
61 Reset_Handler:
62
63 /* Call the clock system initialization function.*/
► 64 bl SystemInit
65
66 /* Copy the data segment initializers from flash to SRAM */
67 ldr r0, =_sdata
68 ldr r1, =_edata
69 ldr r2, =_sidata
─────────────────────────────────────[ STACK ]──────────────────────────────────────
00:0000│ sp 0x20005000
... ↓ 7 skipped
───────────────────────────────────[ BACKTRACE ]────────────────────────────────────
► 0 0x80038e4 Reset_Handler
────────────────────────────────────────────────────────────────────────────────────
Continuing.
target not halted
target stm32f1x.cpu was not halted when resume was requested
Halt timed out, wake up GDB.
Program received signal SIGINT, Interrupt.
Reset_Handler () at startup_stm32f103xb.s:64
64 bl SystemInit
LEGEND: STACK | HEAP | CODE | DATA | WX | RODATA
───────────────[ REGISTERS / show-flags off / show-compact-regs off ]───────────────
R0 0
R1 0x42420000
R2 0x12c0c0
R3 0x4b03
R4 0
R5 0x40021000
R6 0
R7 0x80000000
R8 0xffff
R9 0x1000
R10 0x20000054
R11 0x77bdd31d
R12 0xf8ff
SP 0x20005000
LR 0xffffffff
PC 0x80038e4
──────────────────[ DISASM / armcm / thumb mode / set emulate on ]──────────────────
► 0x80038e4 <Reset_Handler> movs r0, r0
0x80038e6 <Reset_Handler+2> movs r0, r0
0x80038e8 <Reset_Handler+4> movs r0, r0
0x80038ea <Reset_Handler+6> movs r0, r0
0x80038ec <Reset_Handler+8> movs r0, r0
0x80038ee <Reset_Handler+10> movs r0, r0
0x80038f0 <Reset_Handler+12> movs r0, r0
0x80038f2 <Reset_Handler+14> movs r0, r0
0x80038f4 <Reset_Handler+16> movs r0, r0
0x80038f6 <Reset_Handler+18> movs r0, r0
0x80038f8 <Reset_Handler+20> movs r0, r0
─────────────────────────────────[ SOURCE (CODE) ]──────────────────────────────────
In file: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/startup_stm32f103xb.s:64
59 .weak Reset_Handler
60 .type Reset_Handler, %function
61 Reset_Handler:
62
63 /* Call the clock system initialization function.*/
► 64 bl SystemInit
65
66 /* Copy the data segment initializers from flash to SRAM */
67 ldr r0, =_sdata
68 ldr r1, =_edata
69 ldr r2, =_sidata
─────────────────────────────────────[ STACK ]──────────────────────────────────────
00:0000│ sp 0x20005000
... ↓ 7 skipped
───────────────────────────────────[ BACKTRACE ]────────────────────────────────────
► 0 0x80038e4 Reset_Handler
────────────────────────────────────────────────────────────────────────────────────
Continuing.
target not halted
target stm32f1x.cpu was not halted when resume was requested
The target is not running when halt was requested, stopping GDB.
Program received signal SIGINT, Interrupt.
Reset_Handler () at startup_stm32f103xb.s:64
64 bl SystemInit
LEGEND: STACK | HEAP | CODE | DATA | WX | RODATA
───────────────[ REGISTERS / show-flags off / show-compact-regs off ]───────────────
R0 0
R1 0x42420000
R2 0x12c0c0
R3 0x4b03
R4 0
R5 0x40021000
R6 0
R7 0x80000000
R8 0xffff
R9 0x1000
R10 0x20000054
R11 0x77bdd31d
R12 0xf8ff
SP 0x20005000
LR 0xffffffff
PC 0x80038e4
──────────────────[ DISASM / armcm / thumb mode / set emulate on ]──────────────────
► 0x80038e4 <Reset_Handler> movs r0, r0
0x80038e6 <Reset_Handler+2> movs r0, r0
0x80038e8 <Reset_Handler+4> movs r0, r0
0x80038ea <Reset_Handler+6> movs r0, r0
0x80038ec <Reset_Handler+8> movs r0, r0
0x80038ee <Reset_Handler+10> movs r0, r0
0x80038f0 <Reset_Handler+12> movs r0, r0
0x80038f2 <Reset_Handler+14> movs r0, r0
0x80038f4 <Reset_Handler+16> movs r0, r0
0x80038f6 <Reset_Handler+18> movs r0, r0
0x80038f8 <Reset_Handler+20> movs r0, r0
─────────────────────────────────[ SOURCE (CODE) ]──────────────────────────────────
In file: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/startup_stm32f103xb.s:64
59 .weak Reset_Handler
60 .type Reset_Handler, %function
61 Reset_Handler:
62
63 /* Call the clock system initialization function.*/
► 64 bl SystemInit
65
66 /* Copy the data segment initializers from flash to SRAM */
67 ldr r0, =_sdata
68 ldr r1, =_edata
69 ldr r2, =_sidata
─────────────────────────────────────[ STACK ]──────────────────────────────────────
00:0000│ sp 0x20005000
... ↓ 7 skipped
───────────────────────────────────[ BACKTRACE ]────────────────────────────────────
► 0 0x80038e4 Reset_Handler
────────────────────────────────────────────────────────────────────────────────────
Error erasing flash with vFlashErase packet
Detaching from program: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/build/stm32f1_buisnesscard_v1.elf, Remote target
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
benchmark.gdb:49: Error in sourced command file:
Error erasing flash with vFlashErase packet
------- tip of the day (disable with set show-tips off) -------
Use the pipe <cmd> | <prog> command to pass output of a GDB/Pwndbg command to a shell program, e.g. pipe elfsections | grep bss. This can also be shortened to: | <cmd> | <prog>
LEGEND: STACK | HEAP | CODE | DATA | WX | RODATA
───────────────[ REGISTERS / show-flags off / show-compact-regs off ]───────────────
R0 0x40
R1 0x80
R2 1
R3 0x20003548
R4 0x97
R5 6
R6 0x8003a20
R7 0
R8 0xffff
R9 0x1000
R10 0x20000054
R11 0x77bdd31d
R12 0
SP 0x20005000
LR 0xffffffff
PC 0x80038e4
──────────────────[ DISASM / armcm / thumb mode / set emulate on ]──────────────────
► 0x80038e4 <Reset_Handler> bl #SystemInit <SystemInit>
0x80038e8 <Reset_Handler+4> ldr r0, [pc, #0x2c] R0, [LoopFillZerobss+14]
0x80038ea <Reset_Handler+6> ldr r1, [pc, #0x30] R1, [LoopFillZerobss+18]
0x80038ec <Reset_Handler+8> ldr r2, [pc, #0x30] R2, [LoopFillZerobss+22]
0x80038ee <Reset_Handler+10> movs r3, #0 R3 => 0
0x80038f0 <Reset_Handler+12> b #Reset_Handler+20 <Reset_Handler+20>
0x80038f8 <Reset_Handler+20> adds r4, r0, r3
0x80038fa <Reset_Handler+22> cmp r4, r1
0x80038fc <Reset_Handler+24> blo #Reset_Handler+14 <Reset_Handler+14>
0x80038fe <Reset_Handler+26> ldr r2, [pc, #0x24] R2, [LoopFillZerobss+26]
0x8003900 <Reset_Handler+28> ldr r4, [pc, #0x24] R4, [LoopFillZerobss+30]
─────────────────────────────────[ SOURCE (CODE) ]──────────────────────────────────
In file: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/startup_stm32f103xb.s:64
59 .weak Reset_Handler
60 .type Reset_Handler, %function
61 Reset_Handler:
62
63 /* Call the clock system initialization function.*/
► 64 bl SystemInit
65
66 /* Copy the data segment initializers from flash to SRAM */
67 ldr r0, =_sdata
68 ldr r1, =_edata
69 ldr r2, =_sidata
─────────────────────────────────────[ STACK ]──────────────────────────────────────
00:0000│ sp 0x20005000
... ↓ 7 skipped
───────────────────────────────────[ BACKTRACE ]────────────────────────────────────
► 0 0x80038e4 Reset_Handler
────────────────────────────────────────────────────────────────────────────────────
Continuing.
target not halted
target stm32f1x.cpu was not halted when resume was requested
Program received signal SIGINT, Interrupt.
0x08003428 in HAL_PWR_EnterSLEEPMode (Regulator=Regulator@entry=1, SLEEPEntry=SLEEPEntry@entry=1 '\001') at Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c:432
432 __WFI();
LEGEND: STACK | HEAP | CODE | DATA | WX | RODATA
───────────────[ REGISTERS / show-flags off / show-compact-regs off ]───────────────
*R0 1
*R1 1
*R2 0xe000ed00
*R3 0
*R4 0x2000009c
*R5 1
*R6 0
*R7 0x2000004c
R8 0xffff
R9 0x1000
R10 0x20000054
R11 0x77bdd31d
R12 0
*SP 0x20004fc0
LR 0x8000ea7
*PC 0x8003428
──────────────────[ DISASM / armcm / thumb mode / set emulate on ]──────────────────
► 0x8003428 <HAL_PWR_EnterSLEEPMode+24> bx lr <main+478>
0x8000ea6 <main+478> ldr r5, [pc, #0x7c] R5, [main+604]
0x8000ea8 <main+480> ldrb r3, [r5] R3, [button_event]
0x8000eaa <main+482> ✔ cbz r3, #main+534 <main+534>
0x8000ede <main+534> bl #HAL_SuspendTick <HAL_SuspendTick>
0x8000ee2 <main+538> movs r1, #1 R1 => 1
0x8000ee4 <main+540> mov r0, r1
0x8000ee6 <main+542> bl #HAL_PWR_EnterSTOPMode <HAL_PWR_EnterSTOPMode>
0x8000eea <main+546> bl #SystemClock_Config <SystemClock_Config>
0x8000eee <main+550> bl #HAL_ResumeTick <HAL_ResumeTick>
0x8000ef2 <main+554> bl #ST7735_wake <ST7735_wake>
─────────────────────────────────[ SOURCE (CODE) ]──────────────────────────────────
In file: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c:432
427
428 /* Select SLEEP mode entry -------------------------------------------------*/
429 if(SLEEPEntry == PWR_SLEEPENTRY_WFI)
430 {
431 /* Request Wait For Interrupt */
► 432 __WFI();
433 }
434 else
435 {
436 /* Request Wait For Event */
437 __SEV();
─────────────────────────────────────[ STACK ]──────────────────────────────────────
00:0000│ sp 0x20004fc0
01:0004│ 0x20004fc4
02:0008│ 0x20004fc8
... ↓ 3 skipped
06:0018│ 0x20004fd8
07:001c│ 0x20004fdc
───────────────────────────────────[ BACKTRACE ]────────────────────────────────────
► 0 0x8003428 HAL_PWR_EnterSLEEPMode+24
1 0x8000ea6 main+478
2 0x8003916 Reset_Handler+50
────────────────────────────────────────────────────────────────────────────────────
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet
Detaching from program: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/build/stm32f1_buisnesscard_v1.elf, Remote target
[Inferior 1 (Remote target) detached]
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
benchmark.gdb:49: Error in sourced command file:
Error erasing flash with vFlashErase packet
------- tip of the day (disable with set show-tips off) -------
Use contextprev and contextnext to display a previous context output again without scrolling
LEGEND: STACK | HEAP | CODE | DATA | WX | RODATA
───────────────[ REGISTERS / show-flags off / show-compact-regs off ]───────────────
R0 1
R1 1
R2 0x40007000
R3 4
R4 0xe000ed00
R5 0x20000050
R6 0
R7 0x2000004c
R8 0xffff
R9 0x1000
R10 0x20000054
R11 0x77bdd31d
R12 0
SP 0x20005000
LR 0xffffffff
PC 0x80038e4
──────────────────[ DISASM / armcm / thumb mode / set emulate on ]──────────────────
► 0x80038e4 <Reset_Handler> movs r0, r0
0x80038e6 <Reset_Handler+2> movs r0, r0
0x80038e8 <Reset_Handler+4> movs r0, r0
0x80038ea <Reset_Handler+6> movs r0, r0
0x80038ec <Reset_Handler+8> movs r0, r0
0x80038ee <Reset_Handler+10> movs r0, r0
0x80038f0 <Reset_Handler+12> movs r0, r0
0x80038f2 <Reset_Handler+14> movs r0, r0
0x80038f4 <Reset_Handler+16> movs r0, r0
0x80038f6 <Reset_Handler+18> movs r0, r0
0x80038f8 <Reset_Handler+20> movs r0, r0
─────────────────────────────────[ SOURCE (CODE) ]──────────────────────────────────
In file: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/startup_stm32f103xb.s:64
59 .weak Reset_Handler
60 .type Reset_Handler, %function
61 Reset_Handler:
62
63 /* Call the clock system initialization function.*/
► 64 bl SystemInit
65
66 /* Copy the data segment initializers from flash to SRAM */
67 ldr r0, =_sdata
68 ldr r1, =_edata
69 ldr r2, =_sidata
─────────────────────────────────────[ STACK ]──────────────────────────────────────
00:0000│ sp 0x20005000
... ↓ 7 skipped
───────────────────────────────────[ BACKTRACE ]────────────────────────────────────
► 0 0x80038e4 Reset_Handler
────────────────────────────────────────────────────────────────────────────────────
Error erasing flash with vFlashErase packet
Continuing.
target not halted
target stm32f1x.cpu was not halted when resume was requested
shutdown command invoked
Remote connection closed
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 14 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
Breakpoint 1 at 0x8000e9a: file Core/Src/main.c, line 129.
Note: automatically using hardware breakpoints for read-only addresses.
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x38c0 lma 0x8000110
Loading section .rodata, size 0x9c lma 0x80039d0
Loading section .init_array, size 0x4 lma 0x8003a6c
Loading section .fini_array, size 0x4 lma 0x8003a70
Loading section .data, size 0x30 lma 0x8003a74
Start address 0x080038e4, load size 15008
Transfer rate: 15 KB/sec, 2501 bytes/write.
Breakpoint 1, main () at Core/Src/main.c:130
130 HAL_SuspendTick();
$1 = {min_r = -1, min_i = -0.5, max_r = 1, max_i = 0.5}
$2 = 1.31749451
$3 = {min_r = 3.1577176569116192, min_i = 0.22066305108751161, max_r = 3.1577882779434727, max_i = 0.22069836160343248}
$4 = 0.183570281
$5 = {min_r = 3.1576023402469482, min_i = 0.22069267606110915, max_r = 3.1576029655564359, max_i = 0.22069298871585336}
$6 = 0.217522398
$7 = {min_r = 1.5143340717923357, min_i = -1.4054856689592869e-05, max_r = 1.5143697529846534, max_i = 3.7857394692316253e-06}
$8 = 0.761290252
Quit
Detaching from program: /home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1/build/stm32f1_buisnesscard_v1.elf, Remote target
Remote connection closed

View File

@ -6,13 +6,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -37,13 +37,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -68,13 +68,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -99,13 +99,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -130,13 +130,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -161,13 +161,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -192,13 +192,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -223,13 +223,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -254,13 +254,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -285,13 +285,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -316,13 +316,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -347,13 +347,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -378,13 +378,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -409,13 +409,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -440,13 +440,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -471,13 +471,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -502,13 +502,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -533,13 +533,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -564,13 +564,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -595,13 +595,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -626,13 +626,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -657,13 +657,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -688,13 +688,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -721,13 +721,13 @@
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DUSE_HAL_DRIVER",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
@ -743,5 +743,36 @@
"build/startup_stm32f103xb.o"
],
"file": "startup_stm32f103xb.s"
},
{
"directory": "/home/indigo/projects/stm32_buisnesscard/program/stm32f1_buisnesscard_v1",
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m3",
"-mthumb",
"-DSTM32F103xB",
"-DUSE_HAL_DRIVER",
"-ICore/Inc",
"-IDrivers/STM32F1xx_HAL_Driver/Inc",
"-IDrivers/CMSIS/Device/ST/STM32F1xx/Include",
"-IDrivers/CMSIS/Include",
"-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"-Ofast",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-ggdb",
"-g3",
"-MMD",
"-MP",
"-MFbuild/benchmark.d",
"-Wall",
"-Wa,-a,-ad,-alms=build/benchmark.lst",
"Core/Src/benchmark.c",
"-o",
"build/benchmark.o"
],
"file": "Core/Src/benchmark.c"
}
]

View File

@ -0,0 +1,5 @@
source /usr/share/pwndbg/gdbinit.py
file build/stm32f1_buisnesscard_v1.elf
target extended localhost:3333
load

View File

@ -0,0 +1,4 @@
border tracing - 255 iter only!
frame shift
change: side that has most iterations is the saved fb
benchamrking: make shift benchmark

View File

@ -56,7 +56,7 @@ ENTRY(Reset_Handler)
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x0; /* required amount of heap */
_Min_Stack_Size = 0x4b16; /* required amount of stack */
_Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
@ -102,7 +102,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
@ -163,6 +163,7 @@ SECTIONS
} >RAM
/* User_heap_stack section, used to check that there is enough RAM left */
/* just a check */
._user_heap_stack :
{
. = ALIGN(8);

View File

@ -125,7 +125,7 @@ ProjectManager.ProjectFileName=stm32f1_buisnesscard_v1.ioc
ProjectManager.ProjectName=stm32f1_buisnesscard_v1
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x4b16
ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=Makefile
ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=

View File

@ -0,0 +1,239 @@
#include <stdint.h>
#include <string.h>
#include "mandelbrot.h"
#include "st7735.h"
#include "benchmark.h"
#include "main.h"
#define RES_X 160
#define RES_Y 80
#define DEFAULT_CENTER_X 0
#define DEFAULT_CENTER_Y 0
#define STEP_SIZE .1
#define ZOOM_SIZE .1
#define DECIMAL_LOC 28
#define DOUBLE_SCALER (1 << DECIMAL_LOC)
#define DOUBLE_TO_FIXED(val) (int32_t)((val) * DOUBLE_SCALER)
#define FIXED_MULTIPLY(x,y) ((((uint64_t)(x))*(y)) >> DECIMAL_LOC)
#define FIXED_TO_DOUBLE(val) ((val) / (double)DOUBLE_SCALER)
#define INFTY 2
#define INFTY_SQR INFTY * INFTY
#define ITERS 255
#define INFTY_SQR_FIXED DOUBLE_TO_FIXED(INFTY_SQR)
//TODO move to some hardware.h or somethin
//channel order: B, G, R
#define R_BITS 5
#define G_BITS 6
#define B_BITS 5
//imaginary axis set automatically
#define CAM_DEF_MIN_R -1
#define CAM_DEF_MAX_R 1
//set controls
#define CAM_MOVE_UP BUTTON_UP
#define CAM_MOVE_RIGHT BUTTON_RIGHT
#define CAM_MOVE_DOWN BUTTON_DOWN
#define CAM_MOVE_LEFT BUTTON_LEFT
#define CAM_ZOOM_IN BUTTON_A
#define CAM_ZOOM_OUT BUTTON_B
struct camera {
double min_r, min_i, max_r, max_i;
};
enum VIEW_MODES { VIEW_UNINIT, VIEW_MANDREL, VIEW_SHIP };
void init_colorscheme_mandrel(uint16_t *scheme) {
uint16_t *tc = scheme;
for(unsigned int i = 0; i < ITERS; i++) {
if((i == 0) || (i == ITERS)) *tc = 0;
else if(i < 128) *tc = (((((i - 64) << 2)+0x1f) & 0x1f) | (((((i - 128) << 1)+0x1f) & 0x1f) << (5+6)));
else *tc = (-2*(i - 128)+0x1f) & 0xff;
*tc = (*tc << 8) | (*tc >> 8); //convert to little endian
tc++;
}
}
void init_colorscheme_ship(uint16_t *scheme) {
uint16_t *tc = scheme;
for(unsigned int i = 0; i < ITERS; i++) {
if((i == 0) || (i == ITERS)) *tc = 0;
else *tc = (((i - (128)) << 1)+0x1f) << (5+6);
tc++;
}
}
void cam_shift(struct camera *cam, double step_r, double step_i) {
double i_offset = (cam->max_i - cam->min_i) * step_i;
double r_offset = (cam->max_r - cam->min_r) * step_r;
cam->min_i += i_offset;
cam->max_i += i_offset;
cam->min_r += r_offset;
cam->max_r += r_offset;
}
void cam_zoom(struct camera *cam, double zoom) {
double i_scale = (cam->max_i - cam->min_i) * zoom;
double r_scale = (cam->max_r - cam->min_r) * zoom;
cam->min_i += i_scale;
cam->max_i -= i_scale;
cam->min_r += r_scale;
cam->max_r -= r_scale;
}
//TODO look into border tracing; this is too slow. Change name
//
void render_mandelbrot(uint16_t *framebuffer, uint16_t *colorscheme, struct camera cam, int x0, int y0, int w, int h) {
int32_t scale_i = DOUBLE_TO_FIXED((cam.max_i - cam.min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam.max_r - cam.min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED((((cam.max_i - cam.min_i) * (RES_Y - y0)) / RES_Y) + cam.min_i);
int32_t c_r0 = DOUBLE_TO_FIXED((((cam.max_r - cam.min_r) * x0) / RES_X) + cam.min_r);
int32_t c_r, z_i, z_r, zn_r, z_r_2, z_i_2;
size_t fb_index = 0;
int i;
//for(;;);
for(int y = y0; y < y0 + h; y++) {
c_r = c_r0;
for(int x = x0; x < x0 + w; x++) {
z_i = 0;
z_r = 0;
for(i = 0; i < ITERS; i++) {
z_r_2 = FIXED_MULTIPLY(z_r, z_r);
z_i_2 = FIXED_MULTIPLY(z_i, z_i);
zn_r = z_r_2 - z_i_2 + c_r;
//z_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + c_i;
z_i = (FIXED_MULTIPLY(z_r, z_i) << 1) + c_i;
z_r = zn_r;
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) break;
}
framebuffer[fb_index++] = colorscheme[i];
c_r += scale_r;
}
c_i -= scale_i;
}
}
#define FB_SIZE_X RES_X
#define FB_SIZE_Y RES_Y/2
//TODO rename
void draw_mandelbrot(int key_pressed) {
static uint16_t framebuffer[FB_SIZE_X * FB_SIZE_Y];
uint16_t columnbuffer[8*RES_Y];
static bool bottom_buffered = true;
//program flow is awful atm becuase I was planning something different; will be improved soon.
static struct camera cam = {
.min_r = CAM_DEF_MIN_R,
.max_r = CAM_DEF_MAX_R,
.min_i = ((double)RES_Y / RES_X) * CAM_DEF_MIN_R,
.max_i = ((double)RES_Y / RES_X) * CAM_DEF_MAX_R,
};
static int view_mode = VIEW_UNINIT;
static uint16_t colorscheme[ITERS];
//we could get rid of this and do some awful bitbashing lol
//but for readability, we shant
//TODO camera moves l/r more then u/d for some reason
/**
if(key_pressed & CAM_MOVE_UP) cam_shift(&cam, 0, STEP_SIZE);
if(key_pressed & CAM_MOVE_DOWN) cam_shift(&cam, 0, -STEP_SIZE);
if(key_pressed & CAM_MOVE_RIGHT) cam_shift(&cam, -STEP_SIZE, 0);
if(key_pressed & CAM_MOVE_LEFT) cam_shift(&cam, STEP_SIZE, 0);
if(key_pressed & CAM_ZOOM_IN) cam_zoom(&cam, ZOOM_SIZE);
if(key_pressed & CAM_ZOOM_OUT) cam_zoom(&cam, -ZOOM_SIZE);
**/
//yes, I know the following is disgusting. Before I clean it, I just wanna get the general idea out,
//it's more efficient in that order
//TODO once you get your idea ironed out, clean the code and improve the flow
benchmark_start();
if(view_mode == VIEW_UNINIT) {
view_mode = VIEW_MANDREL;
init_colorscheme_mandrel(colorscheme);
render_mandelbrot(framebuffer, colorscheme, cam, 0, 0, RES_X, RES_Y/2);
ST7735_DrawImage(0, 0, RES_X, (RES_Y / 2), framebuffer);
render_mandelbrot(framebuffer, colorscheme, cam, 0, RES_Y/2, RES_X, RES_Y/2);
ST7735_DrawImage(0, (RES_Y / 2), RES_X, (RES_Y / 2), framebuffer);
bottom_buffered = true;
}
else {
uint16_t top_line = bottom_buffered ? (RES_Y/2) : 0;
switch(key_pressed) {
const int y_offset = STEP_SIZE * RES_Y;
const int x_offset = STEP_SIZE * RES_X;
const size_t lines_rendered = (RES_Y/2) - y_offset;
const size_t rendered_area_y = RES_X * lines_rendered * sizeof(uint16_t);
const uint16_t framebuffer_offset_y = framebuffer + (RES_X * y_offset);
const uint16_t columns_rendered = RES_X - x_offset;
const uint16_t
case BUTTON_UP:
cam_shift(&cam, 0, STEP_SIZE);
memmove(framebuffer_offset, framebuffer, rendered_area_y);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, y_offset);
break;
case BUTTON_DOWN:
cam_shift(&cam, 0, -STEP_SIZE);
memmove(framebuffer, framebuffer_offset_y, rendered_area_y);
render_mandelbrot(framebuffer+(RES_X*lines_rendered), colorscheme, cam, 0, bottom_buffered ? RES_Y : lines_rendered, RES_X, y_offset);
break;
case BUTTON_RIGHT:
cam_shift(&cam, STEP_SIZE, 0);
render_mandelbrot(columnbuffer, colorscheme, cam, RES_X - x_offset, top_line, x_offset, RES_Y/2);
for(uint16_t y = 0; y < RES_Y/2; y++) {
memmove(framebuffer + (RES_X * y), framebuffer + (RES_X * y) + x_offset, (RES_X - x_offset) * sizeof(*framebuffer));
memmove(framebuffer + (RES_X * y) + (RES_X - x_offset), columnbuffer + (x_offset * y), x_offset * sizeof(*framebuffer));
}
break;
case BUTTON_LEFT:
cam_shift(&cam, -STEP_SIZE, 0);
render_mandelbrot(columnbuffer, colorscheme, cam, 0, top_line, x_offset, RES_Y/2);
for(uint16_t y = 0; y < RES_Y/2; y++) {
memmove(framebuffer + (RES_X * y) + x_offset, framebuffer + (RES_X * y), (RES_X - x_offset) * sizeof(*framebuffer));
memmove(framebuffer + (RES_X * y), columnbuffer + (x_offset * y), x_offset * sizeof(*framebuffer));
}
break;
case BUTTON_A:
cam_zoom(&cam, ZOOM_SIZE);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
break;
case BUTTON_B:
cam_zoom(&cam, -ZOOM_SIZE);
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
break;
default:
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
}
ST7735_DrawImage(0, top_line, RES_X, (RES_Y/2), framebuffer);
bottom_buffered = !bottom_buffered;
top_line = bottom_buffered ? (RES_Y/2) : 0;
render_mandelbrot(framebuffer, colorscheme, cam, 0, top_line, RES_X, RES_Y/2);
ST7735_DrawImage(0, top_line, RES_X, (RES_Y/2), framebuffer);
}
benchmark_stop();
/**
render_mandelbrot(framebuffer, colorscheme, cam, false, key_pressed);
ST7735_DrawImage(0, 0, ST7735_WIDTH, (ST7735_HEIGHT / 2), framebuffer);
render_mandelbrot(framebuffer, colorscheme, cam, true, key_pressed);
ST7735_DrawImage(0, (ST7735_HEIGHT / 2), ST7735_WIDTH, (ST7735_HEIGHT / 2), framebuffer);
**/
// ST7735_DrawImage(0, 0, ST7735_WIDTH - 1, ST7735_HEIGHT - 1, (uint16_t *)0x80000000);
}

View File

@ -0,0 +1,28 @@
start_pwndbg
break test
c
start
print bitarray
context
next
nexti
print bitarray
quit
start_pwndbg
break test
c
r
next
print bitarray
next
print bitarray
quit
start_pwndbg
start
break test
c
next
print bitarray
next
print bitarray
exit

View File

@ -0,0 +1,210 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <raylib.h>
#include <raymath.h>
#include <limits.h>
#define WINDOW_SIZE_X 1600
#define WINDOW_SIZE_Y 800
#define RES_X 1600
#define RES_Y 800
#define DEFAULT_CENTER_X 0
#define DEFAULT_CENTER_Y 0
#define MOUSE_BUTTON 0
#define STEP_SIZE .1
#define ZOOM_SIZE .1
#define DECIMAL_LOC 28
#define DOUBLE_SCALER (1 << DECIMAL_LOC)
#define DOUBLE_TO_FIXED(val) (int32_t)((val) * DOUBLE_SCALER)
#define FIXED_MULTIPLY(x,y) ((((uint64_t)(x))*(y)) >> DECIMAL_LOC)
#define FIXED_TO_DOUBLE(val) ((val) / (double)DOUBLE_SCALER)
#define INFTY 2
#define INFTY_SQR INFTY * INFTY
#define ITERS 255
#define INFTY_SQR_FIXED DOUBLE_TO_FIXED(INFTY_SQR)
//#define SHIP
#undef SHIP
#ifdef SHIP
Color get_color(int i) {
if(i == ITERS) return (Color){0, 0, 0, 255};
if(i == 0) return (Color){0, 0, 0, 255};
return (Color) {
2*(i - 128)+255,
0,
0,
255
};
}
#else
Color get_color(int i) {
if((i == ITERS) || (i == 0)) return (Color){0, 0, 0, 255};
if(i < 128) {
return (Color) {
(8*(i - 128)+255) & 0xff,
0,
(16*(i - 64)+255) & 0xff,
255
};
}
return (Color) {
0,
0,
((unsigned int)-2*(i - 128)+255) & 0xff,
255
};
}
#endif
struct camera {
double min_r, min_i, max_r, max_i;
};
struct vec2_double {
double x, y;
};
struct vec2_float {
int32_t x, y;
};
static inline int iterate(int32_t r, int32_t i) {
int32_t z_i = 0;
int32_t z_r = 0;
int32_t z_r_2, z_i_2, zn_r, zn_i;
for(int it = 0; it < ITERS; it++) {
z_r_2 = FIXED_MULTIPLY(z_r, z_r);
z_i_2 = FIXED_MULTIPLY(z_i, z_i);
zn_r = z_r_2 - z_i_2 + r;
#ifdef SHIP
zn_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + i;
#else
zn_i = (FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + i;
#endif
z_i = zn_i;
z_r = zn_r;
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) return it;
}
return ITERS;
}
//blllluuuuurg, matracies and vectors in raylib are floats and we need doubles
void shift_cam(struct camera *cam, double step_r, double step_i) {
double i_offset = (cam->max_i - cam->min_i) * step_i;
double r_offset = (cam->max_r - cam->min_r) * step_r;
cam->min_i += i_offset;
cam->max_i += i_offset;
cam->min_r += r_offset;
cam->max_r += r_offset;
}
void zoom_cam(struct camera *cam, double zoom) {
double i_scale = (cam->max_i - cam->min_i) * zoom;
double r_scale = (cam->max_r - cam->min_r) * zoom;
cam->min_i += i_scale;
cam->max_i -= i_scale;
cam->min_r += r_scale;
cam->max_r -= r_scale;
}
enum DIRECTIONS {
N, NE, E, SE, S, SW, W, NW
};
int main() {
Color *pixels = malloc(RES_X * RES_Y * sizeof(Color));
struct camera cam = {
.min_r = -1,
.max_r = 1,
// .min_i = -1,
// .max_i = 1
};
cam.min_i = ((double)RES_Y / RES_X) * cam.min_r;
cam.max_i = ((double)RES_Y / RES_X) * cam.max_r;
InitWindow(WINDOW_SIZE_X, WINDOW_SIZE_Y, "mandelbrot fixed point test");
Image img = GenImageColor(RES_X, RES_Y, BLUE);
Texture tex = LoadTextureFromImage(img);
UnloadImage(img);
SetTargetFPS(10);
while(!WindowShouldClose()) {
switch(GetKeyPressed()) {
case KEY_UP:
shift_cam(&cam, 0, STEP_SIZE);
break;
case KEY_DOWN:
shift_cam(&cam, 0, -STEP_SIZE);
break;
case KEY_RIGHT:
shift_cam(&cam, STEP_SIZE, 0);
break;
case KEY_LEFT:
shift_cam(&cam, -STEP_SIZE, 0);
break;
case KEY_W:
zoom_cam(&cam, ZOOM_SIZE);
break;
case KEY_S:
zoom_cam(&cam, -ZOOM_SIZE);
break;
default:
BeginDrawing();
EndDrawing();
continue;
break;
}
printf("(%.6f, %.6f) - (%.6f, %.6f)\n", cam.min_r, cam.min_i, cam.max_r, cam.max_i);
struct coords {
int x, y
};
{
int32_t scale_i = DOUBLE_TO_FIXED((cam.max_i - cam.min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam.max_r - cam.min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED(cam.max_i);
int32_t c_r;
uint8_t rendered[(RES_X * RES_Y) / 8] = {0};
uint8_t edges[(RES_X * RES_Y) / 8] = {0};
int32_t directions_r[8] = {0, scale_r, scale_r, scale_r, 0, -scale_r, -scale_r, -scale_r};
int32_t directions_i[8] = {scale_i, scale_i, 0, -scale_i, -scale_i, -scale_i, 0, scale_i};
int i;
for(int y = 0; y < RES_Y; y++) {
c_r = DOUBLE_TO_FIXED(cam.min_r);
for(int x = 0; x < RES_X; x++) {
int i = iterate(c_r, c_i);
if(i >= ITERS) {
int start_x = x;
int start_y = y;
do {
for(int canidate_d = 0; canidate_d < NW; canidate_d++) {
}
} while((x != start_x) && (y != start_y));
}
pixels[((y * RES_X) + x)] = get_color(iterate(c_r, c_i));
c_r += scale_r;
}
c_i -= scale_i;
}
}
BeginDrawing();
UpdateTexture(tex, pixels);
DrawTextureEx(tex, (Vector2){0,0}, 0, (float)GetRenderWidth()/RES_X, WHITE);
EndDrawing();
}
return 0;
}

View File

@ -1,26 +1,105 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <raylib.h>
#include <raymath.h>
#include <limits.h>
#define RES_X 160
#define RES_Y 80
#define DEFAULT_CENTER_X 0
#define DEFAULT_CENTER_Y 0
#define MOUSE_BUTTON 0
#define STEP_SIZE .25
#define ZOOM_SIZE .25
#define WINDOW_SIZE_X 1600
#define WINDOW_SIZE_Y 800
#define RES_X 160
#define RES_Y 80
#define DEFAULT_CENTER_X 0
#define DEFAULT_CENTER_Y 0
#define MOUSE_BUTTON 0
#define STEP_SIZE .1
#define ZOOM_SIZE .1
#define INFTY 2
#define DECIMAL_LOC 28
#define DOUBLE_SCALER (1 << DECIMAL_LOC)
#define DOUBLE_TO_FIXED(val) (int32_t)((val) * DOUBLE_SCALER)
#define FIXED_MULTIPLY(x,y) ((((uint64_t)(x))*(y)) >> DECIMAL_LOC)
#define FIXED_TO_DOUBLE(val) ((val) / (double)DOUBLE_SCALER)
#define INFTY 2
#define INFTY_SQR INFTY * INFTY
#define ITERS 255
#define ITERS 255
#define INFTY_SQR_FIXED DOUBLE_TO_FIXED(INFTY_SQR)
//#define SHIP
#undef SHIP
#ifdef SHIP
Color get_color(int i) {
if(i == ITERS) return (Color){0, 0, 0, 255};
if(i == 0) return (Color){0, 0, 0, 255};
return (Color) {
2*(i - 128)+255,
0,
0,
255
};
}
#else
Color get_color(int i) {
// if((i == ITERS) || (i == 0)) return (Color){0, 0, 0, 255};
if(i == ITERS) return (Color){0,255,0,255};
if(i == 0) return (Color){0, 0, 0, 255};
if(i < 128) {
return (Color) {
(8*(i - 128)+255) & 0xff,
0,
(16*(i - 64)+255) & 0xff,
255
};
}
return (Color) {
0,
0,
((unsigned int)-2*(i - 128)+255) & 0xff,
255
};
}
#endif
struct camera {
double min_r, min_i, max_r, max_i;
};
struct vec2_double {
double x, y;
};
struct vec2_float {
int32_t x, y;
};
static inline int iterate(int32_t r, int32_t i) {
int32_t z_i = 0;
int32_t z_r = 0;
int32_t z_r_2, z_i_2, zn_r, zn_i;
for(int it = 0; it < ITERS; it++) {
z_r_2 = FIXED_MULTIPLY(z_r, z_r);
z_i_2 = FIXED_MULTIPLY(z_i, z_i);
zn_r = z_r_2 - z_i_2 + r;
#ifdef SHIP
zn_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + i;
#else
zn_i = (FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + i;
#endif
z_i = zn_i;
z_r = zn_r;
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) return it;
}
return ITERS;
}
//blllluuuuurg, matracies and vectors in raylib are floats and we need doubles
void shift_cam(struct camera *cam, double step_r, double step_i) {
double i_offset = (cam->max_i - cam->min_i) * step_i;
@ -40,23 +119,29 @@ void zoom_cam(struct camera *cam, double zoom) {
cam->max_r -= r_scale;
}
enum DIRECTIONS {
N, NE, E, SE, S, SW, W, NW
};
int main() {
int key_pressed;
Color *pixels = malloc(RES_X * RES_Y * sizeof(Color));
struct camera cam = {
.min_r = -1,
.max_r = 1,
yru += di*(targety - yru)/10.;
} .min_i = -1,
.max_i = 1
// .min_i = -1,
// .max_i = 1
};
InitWindow(RES_X, RES_Y, "mandelbrot fixed point test");
cam.min_i = ((double)RES_Y / RES_X) * cam.min_r;
cam.max_i = ((double)RES_Y / RES_X) * cam.max_r;
InitWindow(WINDOW_SIZE_X, WINDOW_SIZE_Y, "mandelbrot fixed point test");
Image img = GenImageColor(RES_X, RES_Y, BLUE);
Texture tex = LoadTextureFromImage(img);
UnloadImage(img);
SetTargetFPS(10);
while(!WindowShouldClose()) {
switch(GetKeyPressed()) {
case KEY_UP:
@ -72,7 +157,6 @@ int main() {
shift_cam(&cam, -STEP_SIZE, 0);
break;
case KEY_W:
printf("a\n");
zoom_cam(&cam, ZOOM_SIZE);
break;
case KEY_S:
@ -84,35 +168,26 @@ int main() {
continue;
break;
}
printf("(%f, %f) - (%f, %f)\n", cam.min_r, cam.min_i, cam.max_r, cam.max_i);
printf("(%.21f, %.21f) - (%.21f, %.21f)\n", cam.min_r, cam.min_i, cam.max_r, cam.max_i);
{
//double scale_i = (cam.max_i - cam.min_i) / (double)GetRenderHeight();
//double scale_r = (cam.max_r - cam.min_r) / (double)GetRenderWidth();
double scale_i = (cam.max_i - cam.min_i) / (double)RES_Y;
double scale_r = (cam.max_r - cam.min_r) / (double)RES_X;
double c_i = cam.max_i;
double c_r;
double z_i;
double z_r;
double zn_r, zn_i;
int i;
uint8_t color;
int32_t scale_i = DOUBLE_TO_FIXED((cam.max_i - cam.min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam.max_r - cam.min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED(cam.max_i);
int32_t c_r;
for(int y = 0; y < RES_Y; y++) {
c_r = cam.min_r;
c_r = DOUBLE_TO_FIXED(cam.min_r);
for(int x = 0; x < RES_X; x++) {
z_i = 0;
z_r = 0;
for(i = 0; i < ITERS; i++) {
zn_r = pow(z_r, 2.0) - pow(z_i, 2.0) + c_r;
zn_i = (2.0 * z_r * z_i) + c_i;
z_i = zn_i;
z_r = zn_r;
if((pow(z_i, 2.0) + pow(z_r, 2.0)) > INFTY_SQR) {
break;
}
int i = iterate(c_r, c_i);
if(i >= ITERS) {
int start_x = x;
int start_y = y;
do {
for(int canidate_d = 0; canidate_d < NW; canidate_d++) {
}
} while((x != start_x) && (y != start_y));
}
color = ((float)i / ITERS) * UINT8_MAX;
pixels[((y * RES_X) + x)] = (Color){color, color, color, 255};
pixels[((y * RES_X) + x)] = get_color(iterate(c_r, c_i));
c_r += scale_r;
}
c_i -= scale_i;
@ -121,7 +196,7 @@ int main() {
BeginDrawing();
UpdateTexture(tex, pixels);
DrawTexture(tex, 0, 0, WHITE);
DrawTextureEx(tex, (Vector2){0,0}, 0, (float)GetRenderWidth()/RES_X, WHITE);
EndDrawing();
}

View File

@ -4,6 +4,7 @@
#include <raylib.h>
#include <raymath.h>
#include <limits.h>
#include <complex.h>
#define WINDOW_SIZE_X 1600
#define WINDOW_SIZE_Y 800
@ -28,6 +29,7 @@
#define INFTY_SQR_FIXED DOUBLE_TO_FIXED(INFTY_SQR)
#define SHIP
//#undef SHIP
#ifdef SHIP
Color get_color(int i) {
@ -42,7 +44,9 @@ Color get_color(int i) {
}
#else
Color get_color(int i) {
if((i == ITERS) || (i == 0)) return (Color){0, 0, 0, 255};
// if((i == ITERS) || (i == 0)) return (Color){0, 0, 0, 255};
if(i == ITERS) return (Color){0,255,0,255};
if(i == 0) return (Color){0, 0, 0, 255};
if(i < 128) {
return (Color) {
(8*(i - 128)+255) & 0xff,
@ -65,6 +69,38 @@ struct camera {
double min_r, min_i, max_r, max_i;
};
struct vec2_double {
double x, y;
};
struct vec2_float {
int32_t x, y;
};
static inline int iterate(int32_t r, int32_t i) {
int32_t z_i = 0;
int32_t z_r = 0;
int32_t z_r_2, z_i_2, zn_r, zn_i;
for(int it = 0; it < ITERS; it++) {
z_r_2 = FIXED_MULTIPLY(z_r, z_r);
z_i_2 = FIXED_MULTIPLY(z_i, z_i);
zn_r = z_r_2 - z_i_2 + r;
#ifdef SHIP
zn_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + i;
#else
zn_i = (FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + i;
#endif
z_i = zn_i;
z_r = zn_r;
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) return it;
}
return ITERS;
}
//blllluuuuurg, matracies and vectors in raylib are floats and we need doubles
void shift_cam(struct camera *cam, double step_r, double step_i) {
double i_offset = (cam->max_i - cam->min_i) * step_i;
@ -84,7 +120,132 @@ void zoom_cam(struct camera *cam, double zoom) {
cam->max_r -= r_scale;
}
enum DIRECTIONS {
N, NE, E, SE, S, SW, W, NW
};
typedef struct {
double x; double y;
} coordinate;
//we can inline these if needed
inline bool bitarray_check(uint8_t *array, size_t i) {
return array[i/8] & (1 << (i%8));
}
inline void bitarray_set(uint8_t *array, size_t i) {
array[i/8] |= (1 << (i%8));
}
/**
inline coordinate get_neighbor_coord(coordinate from_coord, int direction, coordinate step) {
if((direction == NW) && (direction < E)) from_coord.x += ;
if((direction > N) && (direction < S)) from_coord += 1;
if((direction > E) && (direction < W)) from_coord += RES_X;
if(direction > S) from_coord -= 1;
return from_coord;
}
**/
size_t get_neighbor_index(size_t from_pixel, int direction) {
//canidate for optimization; lots of branches. maybe inline
if((direction == NW) && (direction < E)) from_pixel -= RES_X;
if((direction > N) && (direction < S)) from_pixel += 1;
if((direction > E) && (direction < W)) from_pixel += RES_X;
if(direction > S) from_pixel -= 1;
return from_pixel;
}
bool bitarray_check(uint8_t *array, size_t i);
void bitarray_set(uint8_t *array, size_t i);
#define BITARRAY_SET(array, i) ((array)[(i)/8] |= (1 << ((i) % 8)))
#define BITARRAY_CHECK(array, i) ((array)[(i)/8] & (1 << ((i) % 8)))
/**
enum CANIDATE_STATUS {
UNSOLVED = 0,
CANIDATE,
NONCANIDATE
};
**/
unsigned int mandelbrot_bordertrace(struct camera *cam, Color *pixels) {
//these lookup tables r cheap cuz on the stm32f1, 1 memory read is 1 instruction
const size_t neighbor_index_accl[8] = {-RES_X, -RES_X + 1, 1, RES_X + 1, RES_X, RES_X - 1, -1, -RES_X - 1};
int32_t scale_i = DOUBLE_TO_FIXED((cam->max_i - cam->min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam->max_r - cam->min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED(cam->max_i);
int32_t c_r;
unsigned int total_iters = 0;
size_t on_pixel = 0;
uint8_t border[(160*80)/8] = {0};
//for keeping track of border only. will organize later
uint8_t set[(160*80)/8] = {0};
uint8_t unset[(160*80)/8] = {0};
for(int y = 0; y < RES_Y; y++) {
c_r = DOUBLE_TO_FIXED(cam->min_r);
for(int x = 0; x < RES_X; x++) {
int i = iterate(c_r, c_i);
total_iters += i;
pixels[((y * RES_X) + x)] = get_color(i);
//this is where it all begins
if(i == ITERS) {
int current_border_pixel = on_pixel;
uint8_t visited_border[(160*80)/8] = {0};
int filled_neighbors = 0;
//unroll and manually get_neighbor if this is too slow
for(int nei_dir = 0; nei_dir < 8; nei_dir++) {
size_t nei_i = current_border_pixel + neighbor_index_accl[nei_dir];
if(bitarray_check(set, nei_i)) {
filled_neighbors++;
continue;
}
if(bitarray_check(unset, nei_i)) continue;
}
//if c_d == 7 go back
}
c_r += scale_r;
}
on_pixel++;
c_i -= scale_i;
}
return total_iters;
}
unsigned int mandelbrot_unoptimized(struct camera *cam, Color *pixels) {
int32_t scale_i = DOUBLE_TO_FIXED((cam->max_i - cam->min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam->max_r - cam->min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED(cam->max_i);
int32_t c_r;
unsigned int total_iters = 0;
for(int y = 0; y < RES_Y; y++) {
c_r = DOUBLE_TO_FIXED(cam->min_r);
for(int x = 0; x < RES_X; x++) {
int i = iterate(c_r, c_i);
total_iters += i;
pixels[((y * RES_X) + x)] = get_color(i);
c_r += scale_r;
}
c_i -= scale_i;
}
return total_iters;
}
void test() {
uint8_t bitarray[(160*80)/8] = {0};
int test_i = 9;
BITARRAY_SET(bitarray, test_i);
printf("%s\n", BITARRAY_CHECK(bitarray, 9) ? "true" : "false");
}
int main() {
test();
return 0;
Color *pixels = malloc(RES_X * RES_Y * sizeof(Color));
struct camera cam = {
.min_r = -1,
@ -129,47 +290,10 @@ int main() {
continue;
break;
}
printf("(%.6f, %.6f) - (%.6f, %.6f)\n", cam.min_r, cam.min_i, cam.max_r, cam.max_i);
{
int32_t scale_i = DOUBLE_TO_FIXED((cam.max_i - cam.min_i) / (double)RES_Y);
int32_t scale_r = DOUBLE_TO_FIXED((cam.max_r - cam.min_r) / (double)RES_X);
int32_t c_i = DOUBLE_TO_FIXED(cam.max_i);
int32_t c_r, z_i, z_r, zn_i, zn_r;
int32_t z_r_2, z_i_2;
printf("(%.21f, %.21f) - (%.21f, %.21f)\n", cam.min_r, cam.min_i, cam.max_r, cam.max_i);
int i;
int min = INT_MAX;
int max = INT_MIN;
for(int y = 0; y < RES_Y; y++) {
c_r = DOUBLE_TO_FIXED(cam.min_r);
for(int x = 0; x < RES_X; x++) {
z_i = 0;
z_r = 0;
for(i = 0; i < ITERS; i++) {
z_r_2 = FIXED_MULTIPLY(z_r, z_r);
z_i_2 = FIXED_MULTIPLY(z_i, z_i);
zn_r = z_r_2 - z_i_2 + c_r;
#ifdef SHIP
zn_i = abs(FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + c_i;
#else
zn_i = (FIXED_MULTIPLY((DOUBLE_TO_FIXED(2)), (FIXED_MULTIPLY(z_r, z_i)))) + c_i;
#endif
z_i = zn_i;
z_r = zn_r;
if(z_i_2 + z_r_2 > INFTY_SQR_FIXED) break;
}
if(i > max) max = i;
if(i < min) min = i;
pixels[((y * RES_X) + x)] = get_color(i);
c_r += scale_r;
}
c_i -= scale_i;
}
}
printf("Unoptimized: %u iterations\n", mandelbrot_unoptimized(&cam, pixels));
//printf("Border tracing: %u iterations\n", mandelbrot_unoptimized(cam, pixels);
BeginDrawing();
UpdateTexture(tex, pixels);

View File

@ -1,6 +1,6 @@
.default: make
make:
gcc main.c -o mandelbrot -lraylib -lm -Wall -ggdb
gcc main.c -O0 -o mandelbrot -lraylib -lm -Wall -ggdb
clean:
rm -f mandelbrot

Binary file not shown.

1
stm32_buisnesscard.prf Symbolic link
View File

@ -0,0 +1 @@
/home/indigo/.unison/stm32_buisnesscard.prf