Want to know how to debug the microcontrollers? Want to know how to use debugging tools like step-in, step-out, breakpoints and etc. If yes then you have to right place. Explore this blog to understand about Debugging technology in microcontroller’s with NXP S32K144 MCU using ElecronicsV2 board
Why building the project is required ? so After, we have developed/configured the code and we have got the .c & .h files in our project. Now microcontrollers can’t understand the text which is written in these files. They only understand the Binary language of 0 & 1. So we have to convert these .c & .h files into a single file of binary language which the microcontroller can understand. Now these .c and .h files can be in 1000 numbers in some projects. So you can think of how much processing is done to analyze all files, check them for any errors and then convert them into a single file of binary language. This work is done by compilers and the build process. This technology is truly amazing, and its process is even more interesting. What is building the project in embedded and how is it done? In embedded “building the project” refers to the process of compiling and linking the source code and resources of an embedded software application to create an executable binary file that can be loaded onto the target embedded hardware platform. In Embedded, Build process is the process of converting multiple source files into a single file that can run on a computer. So as to understand this process and the technology behind it, let’s understand the procedure/step involved in doing so. Preprocessing(.i files) Compilation(.s files) Assembly(.o files) Linking(.elf files) Preprocessing(.i files) Preprocessing :- Before the actual compilation, the C preprocessor comes into play. It handles directives that start with `#`, such as `#include` and `#define`. It performs macro expansion and file inclusion. The preprocessor generates a modified version of your code, often saved with a `.i` extension. Compilation(.s files) In this phase, the preprocessed code (`.i` files) is translated into assembly code. This step is performed by the C compiler (e.g., `gcc` for GNU C Compiler). The compiler checks your code for syntax errors and generates an assembly code file (usually with a `.s` extension). Assembly(.o files) The code generated by the compiler is not yet in a machine-executable format. It’s a human-readable representation of the code. The assembler takes this assembly code and translates it into machine code, generating an object file (typically with a `.o` or `.obj` extension). Linking(.elf files) Most C programs consist of multiple source files, and each one might produce an object file. The linker (e.g., `ld` for GNU Linker) combines these object files along with any necessary system libraries to create an executable binary file. This is the final output of the compilation process, often with no file extension or a `.exe` (on Windows) or no extension (on Unix-based systems) for executable files. It’s important to note that the compilation process can be controlled through various compiler options, allowing you to customize how your code is compiled, optimize it, and handle various aspects of the process. Building an embedded project is a crucial step in the development process, as it ensures that the software is correctly translated into machine code and can run effectively on the embedded hardware, meeting the project’s functional and performance requirements. After the building process is done then which file is created. After the build process is done then these files are created and then deployed onto the target embedded hardware. Executable Binary (Firmware) : This is the primary output of the build process. It’s a binary file that contains the machine code instructions and data necessary for the embedded system to execute your program. The format of this binary file may depend on the microcontroller or processor used and can include extensions like .bin, .hex, .elf, .s19, etc. Object Files : During compilation, each source file is typically compiled into an object file (with extensions like .o or .obj). These object files contain machine code generated from the corresponding source code and may include debugging information. Debug Information : Debugging information (often in a format like DWARF) can be included in the binary or stored in separate files. This information helps debuggers associate machine code instructions with your original source code, making it easier to debug your program. Hexadecimal Files : In some cases, especially when programming microcontrollers, you might generate hexadecimal files (with extensions like .hex) that specify the memory contents, including both code and data, in a human-readable format. Assembly Listings : Some build systems can generate assembly listings (with extensions like .lst) that show the generated assembly code alongside your source code. This can be useful for understanding how your high-level code translates into machine code. 7. Other Output Files : Depending on your specific development environment and tools, you might encounter other files related to the build process, such as project configuration files, build logs, or build artifacts generated by plugins or extensions. Like the Cmake , SDK files etc. In this IDE when the build process is done the compiler gives us a .elf file that can be loaded onto the target embedded hardware. The exact set of files generated can vary widely based on your development workflow and tools, so it’s important to consult the documentation for your chosen development environment and build system to understand the specifics for your project.( To understand build process and specifies of S32K144 MCU, refer this). Which tools are used in building the project? When we build an embedded project there are some files and a compiler that is used to build the project. Makefile Linker script Startup code GNU GCC Compiler Make file :- A makefile can be considered as a script or a set of commands which help build, compile, link the entire project in order to create an executable. The makefile defines a set of tasks to be executed.A makefile does not have any extension. The makefile has to be specifically named as “makefile”. Linker Script :- A linker script is used to specify how object files should be linked together to create the final executable binary. It defines the memory layout of the
Overview So hello guys, welcome to series of Microcontroller tutorials. As Microcontrollers are big thing happening across the globe, but to learn about microcontrollers becomes quite challenging as most of the content on web is theoretical based and quite unorganized. Or the content is only roaming around 2-3 microcontrollers (Arduino, ESP or PIC), even though there are number of Microcontrollers of different vendors. Also, framework of Arduino and Arduino IDE hides most of the things that are going inside the microcontrollers. Would recommend viewers to read these 3 blogs in order, so as to get understanding on how to get started with any Microcontroller and in what order. How to start with Microcontrollers? – gettobyte Hardware Development Kit In Mcrocontrollers – gettobyte Software Development Kit In Microcontrollers – gettobyte Here at Gettobyte, you will get content on microcontroller tutorials for different vendors in chronological way and covering the topics, in a much more interesting and story kind of way to make people understood easily. NXP Semiconductors – gettobyte Nordic SoC – gettobyte STM32 MCU’s – gettobyte Texas Instruments – gettobyte Silicon Labs – gettobyte AVR MCU – gettobyte ESP SoC – gettobyte Which will help you to learn important skills to build you Carrer on Semiconductor Industry and also help you in product development/DIY projects for different Industries, so as to make embedded devices with Industry standard Microcontroller. In return what Gettobyte platform seeks is that if you find these blogs insightful, then share it with people so make the reach more. And provide with constructive feedback and reviews in blogs comment section . If you guys want to start with microcontroller coding and looking for chronological order, then you have come to right place. In the last 2 blog: we get to know a lot about microcontrollers and how to start with them. And Hardware Development KIT in microcontrollers. One of the essential and important things to know before starting with microcontrollers is Software Development Kit. So, let’s start with it. In this blog we are going to start with another essential and important things to know before starting with microcontrollers that is Software Development Kit (SDK). Objective of this blog Objective of this blog, will be to understand: What is Software Development Kit in Embedded (SDK). Different components in Software Development Kit in Embedded. Why there is need of Software Development Kit in Embedded. What is Software Development Kit? Software Development Kit in embedded is collection of Software tools and applications, Software libraries, documentations to program the microcontrollers via host computer. Software Development Kit(SDK) majorly include: Software Stack for Microcontrollers Code Configuration Tools Software Debugging Tools Software drivers for debuggers and programmers. Integrated Development Environment (IDE) Software Stack for Microcontrollers Microcontrollers are not only hardware devices, but there is also very good amount of software used in microcontroller to run them, which are termed as software stack for microcontrollers. Software stack for microcontrollers can be divided into following components: Peripherals Drivers/Real Time Drivers: for using the peripherals of microcontrollers. This software controls the registers of microcontrollers to configure, enable, disable and use the different peripherals of microcontroller. Every MCU vendor design and develop these Drivers for their corresponding microcontroller. so that application developers can directly start with application development instead of creating these drivers on own. These drivers are kind of bare metal programming, as it is register level programming. which are written using C/CPP language using the concepts like Functions, loops, variables, static, user defined data types (typedef, Enums, structures), arrays and etc. For e.g. NXP semiconductors has S32K Standard software stack for its S32K1 Microcontrollers. Texas Instruments has Miscellaneous Stack: Peripheral Drivers is stack to drive the microcontroller peripherals, but with these peripheral drivers their is use of other embedded software technologies to build complex and real time applications like RTOSes(FreeRTOS, ChibiOS, Mbed and etc), IoT protocols Stacks( WiFi, BLE, Lora, LwIP, MbedTLS,and etc), Bootrom(openBLT), Sensor & Module drivers, crytography stack for providing security and safety in embedded applications, mathematics or signal processing algorithms stack for doing complex calculations. These all are also written using C/CPP language and it requires knowledge of programming along with hardware knowledge too. Peripheral Abstraction Layer/Hardware Abstraction Layer: This software stack is for code portablity and modularity in microcontrollers. Their are so many microcontrollers out their and for every MCU their is different peripheral driver. So if we change the microcontroller in our application, we need to rewrite the code of our application. This can be very cumbersome, there is need of some form of abstraction layer, through which our application end APIs remain same and just low-level driver files has to be changed if hardware is changed. This is done through the concept of C/CPP programming with use of programming concepts like, Classes, Structures, function pointers, templates, MACRO definition, linked lists and etc. In the large code bases like Autosaur and Ardupilot, Code portability is very essential, and use of Abstraction layers are heavy implemented through advance programming concepts like that of OOPS. For the starting we would just be needing peripheral drivers and abstraction layer stack of microcontrollers. These are provided by corresponding microcontroller vendors. // Examples of different peripheral drivers of MCU’s Code Configuration Tools As told in above sections there are many software stacks used in microcontrollers, so to design and develop the code using these software stack from scratch would be very cumbersome. As we need to include files for every stack and necessary configuration has to be done for building and compiling the code. So Code Configuration Tools are the software tools, which provide GUI based interface and environment to configure the software stack. We just need to select the hardware(microcontroller), what features we need and what all software components and peripheral to be enabled and then click on a button to generate the code. These tools then generate all the base software automatically from startup code to make files for the configured project. The features of CCT includes Graphical User Interface (GUI), tools for configuring peripherals, code generation and project building. In
So hello guys, welcome to series of Microcontroller tutorials. As Microcontrollers are big thing happening across the globe, but to learn about microcontrollers becomes quite challenging as most of the content on web is theoretical based and quite unorganized. Or the content is only roaming around 2-3 microcontrollers (Arduino, ESP or PIC), even though there are number of Microcontrollers of different vendors. Also, framework of Arduino and Arduino IDE hides most of the things that are going inside the microcontrollers. If you guys want to start with microcontroller coding and looking for chronological order then you have come to right place. How to start with Microcontrollers? – gettobyte Hardware Development Kit In Mcrocontrollers – gettobyte Software Development Kit In Microcontrollers – gettobyte Would recommend viewers to read these 3 blogs in order, so as to get understanding on how to get started with any Microcontroller and in what order. In the last blog we get to know a lot about microcontrollers and how to start with them. One of the essential and important things to know before starting with microcontrollers is Hardware Development Kit. So let’s start with it. Objective of this blog Objective of this blog, will be to understand: What is Hardware Development Kit in Embedded (SDK). Different components in Hardware Development Kit in Embedded. Why there is need of Hardware Development Kit in Embedded. What is Hardware Development Kit Hardware Development Kit in embedded is collection of hardware tools to assist developers to design and prototype the products/projects easily on microcontroller and semiconductor chips. These hardware tools majorly include: Microcontroller/SoC Development Boards. Evalution boards Debuggers and programmers. Cables and connectors Breakout boards Microcontroller/SoC In the last blog, all we talk about is microcontrollers, so refer to this blog to know what microcontrollers are. Microcontroller and SoC word would be used quite inerchangibly throughout this blog and in subsequent blogs too. Difference between SoC and MCU is that. (SoC): SoC is a less well-defined term. A SoC is typically an encapsulation of one or more of CPUs, memory, micro-controllers, DSPs, accelerators, and supporting hardware; however, it does not adhere to any standards regarding its containing circuitry. An SoC is intended for applications with requirements that are too complex for a single MCU to handle. To explore about different microcontrollers best place is semiconductor company websites like and many others: NXP® Semiconductors Official Site | NXP Semiconductors Analog | Embedded processing | Semiconductor company | TI.com Silicon Labs (silabs.com) Nordic Semiconductor | Empowering Wireless Innovation – nordicsemi.com STMicroelectronics: Our technology starts with you and etc Go to products page of these websites and then navigate to microcontroller-microprocessor section. You will find there are so many microcontrollers which have been categorized in terms of Either processor they have (ARM Cortex CPU based, 8 bit CPU based, or some proprietary CPU core) Or Microcontroller family name’s (Like LPC series, S32 Series, MSP430 series, Kinetic series, STM32 series) Application based( Digital signal processing, IoT protocol’s, peripheral and etc) and etc. Microcontrollers/SoC can’t be used directly, for making projects or learning out the things. Microcontrollers comes in different packaging like BGA, DIP, QFN, QFP, SOP, SQP. Every package takes up different amount of space. In these packages MCU pins are very small to use and in some packages of MCU, we cant even properly touch individual pins of the MCU (BGA and QFN). Now to connect some sensors/modules to the MCU, we need to connect them to the pins of the MCU. So, there is need of some hardware circuit by which we can expose all these pins of MCU in a way that they can be used for prototyping and developing the embedded application by connecting different sensor/modules. And thus, here comes the story of development boards. Development /Evalution Boards Development boards in the field of embedded systems refer to pre-built circuit boards designed to use the microcontrollers/SoC’s. These boards typically include a microcontroller/SoC or microprocessor, along with essential components required to use the microcontroller like: Input/Output interfaces (Header pins, LEDs, Push buttons and etc.), Power regulators (For powering the MCU/SoC), and Miscellaneous circuit required for microcontroller functioning (oscillator circuit, pull-up/down resistors, decoupling capacitors and etc.) Debugging and programming feature. They provide a convenient platform for developers to test their code, interface with external devices, and evaluate the performance of their embedded system designs. These development boards are extensively used among the college students, hobbyists for making DIY projects or learn the microcontroller coding by having hands-on over the microcontrollers using these kind of development boards. These development boards are connected to Host Desktop/Laptop through USB cable via Debugger/Programmer to program/debug the microcontrollers. Thus, these development board provide easy way to use microcontrollers/microprocessor/SoC. Now for every microcontroller there is a development board for using it. Development boards are designed either by the semiconductor companies itself for their corresponding MCU’s or by the Third-party vendors, like: Arduino is a development board which has Atmega 328 MCU. Atmega 328 MCU is designed by Microchip Semiconductor company, but Arduino is designed and developed by Third party organization Arduino. BluePill is a development board which has STM32F103 MCU. STM32F103 MCU is designed by STMicroelectronics, but Bluepill is designed and developed by third party vendors. ElecronicsV1 is development board which has S32K144 Automotive MCU. S32K144 is designed by NXP Semiconductors, but ElecronicsV1 is designed and developed by Gettobyte community. S32K312 MCU which is Automotive General Purpose MCU designed by NXP Semiconductors, there is development board designed by NXP Semiconductors itself S32K312EVB-Q172. Another example is NRF52840 SoC for General Purpose IoT applications designed by Nordic Semiconductor, there is development board designed by Nordic Semiconductors itself nRF52840 DK. Another example is of STM32WB55 SoC for Low-Power IoT applications designed by STMicroelectronics, there is development board designed by STMicroelectronics itself that is P-NUCLEO-WB55. Another example is of MSP430 MCU for General pupose embedded applications designed by Texas Instruments, there is development board designed by Texas Instruments itself that is MSP-EXP430G2ET Their is one more SoC of NXP Semiconductors JN5189 IoT SoC. NXP semiconductors design and develop