[video member=miotatsu stream_platform=twitch project=riscy title="uart_init, get_cpu_freq, & `static` Legalese" vod_platform=youtube id=HVxZkIliQd0 annotator=Miblo] [0:07][Recap and set the stage for the day] [2:30][Consult Table 7.1: HiFive1 GPIO Offset to Board Pin Number, and locate the definition of IOF0_UART0_MASK[ref site="SiFive Developers" page="SiFive HiFive1 Getting Started Guide" url=https://static.dev.sifive.com/dev-kits/hifive1/hifive1-getting-started-v1.0.3.pdf]][:hardware :research] [6:17][Return to uart_init() and determine to understand how IOF0_UART0_MASK is being used][:peripheral] [8:34][Refresh our memory on the GPIO Complex[ref site="SiFive Developers" page="Freedom E310-G000 Manual" url=https://www.sifive.com/documentation/chips/freedom-e310-g000-manual/] and HW I/O Functions (IOF)[ref site="SiFive Developers" page="Freedom E300 Platform Reference Manual" url=https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/]][:hardware :research] [10:49][Assume the layout of the IOF select register[ref site="SiFive Developers" page="SiFive HiFive1 Getting Started Guide" url=https://static.dev.sifive.com/dev-kits/hifive1/hifive1-getting-started-v1.0.3.pdf]][:hardware :research] [14:09][Consult the annotations for IOF[ref site=YouTube page="RISCY BUSINESS - Day 27: Diving Into Pulse Width Modulation" url=https://www.youtube.com/watch?v=wBy4tjKEF3s]] [17:44][Refresh our memory on the IOF masks for the LEDs][:peripheral] [21:38][Match up our IOF0_UART0_MASK in code with the documentation[ref site="SiFive Developers" page="SiFive HiFive1 Getting Started Guide" url=https://static.dev.sifive.com/dev-kits/hifive1/hifive1-getting-started-v1.0.3.pdf]][:peripheral :research] [25:23][Critique the clarity of using masks instead of offsets for UART0][:experience] [29:09][Consider what the static keyword does in terms of zero initialisation][:language] [41:36][Consult the C11 spec for the default initialisation rule of locally scoped static variables[ref title="ISO/IEC 9899:201x" url=http://open-std.org/JTC1/SC22/WG14/www/docs/n1570.pdf]][:language :research] [53:08][Read section 5.1.2 "Execution environments" in C11 spec, and determine to confirm with SiFive whether their static implementation does zero initialise[ref title="ISO/IEC 9899:201x" url=http://open-std.org/JTC1/SC22/WG14/www/docs/n1570.pdf]][:language :research] [56:56][Read about how the uninitialised .bss segment in Linux executables, which holds global and static variables, initialises variables to zero][:platform :research] [57:59][Recommend not explicitly initialising static and global variables to 0 to save some space][:language :platform :trivia] [59:04][Ask in the forums where it is defined how uninitialised variables with static storage duration are initialized for the HiFive1[ref site="SiFive Forums" page="The Big RISCY BUSINESS Question Thread" url=https://forums.sifive.com/t/the-big-riscy-business-question-thread/531/4]][:platform :research] [1:05:18][We are out of time for tonight] [/video]