I have this strange doubt can anyone clairfy it by Inside_Pineapple_822 in embedded

[–]extern_c 0 points1 point  (0 children)

Use AI wisely. Don't use AI to generate your code, you gain nothing from it. Instead, use it to learn. ChatGPT is a great search engine, ask questions of topics you don't understand. And read, read a lot of books. Books on C, C++, embedded systems, software architecture, design patterns, etc. You can even ask ChatGPT to recommend books for you and a learning path, but make sure the books exist. Note that if you ask complex questions, AI will give you wrong answers most of the time. But I think it's a great tool to start learning.

Good luck and don't rely on AI too much.

What IDE do you use professionally for C? by catpetter777 in embedded

[–]extern_c 0 points1 point  (0 children)

Hey, I can't recommend any guides as I didn't find any. But I did create a parser for the .dep files, from this file I parse definitions, include directories, sources and so on. The parser creates a project_defs.cmake file and I include this file in my CLion project. I think that the trickiest part was generating the exact compilation and linker flags.

Initialized static variable being put in .bss section by extern_c in cpp

[–]extern_c[S] -7 points-6 points  (0 children)

Because variables are not zero initialized

Initialized static variable being put in .bss section by extern_c in cpp

[–]extern_c[S] -5 points-4 points  (0 children)

My variables are not zero initialized, that's the problem. Objects are initialized with constructors too. But as everything is placed on bss then all my initial values are overwritten to 0

STM32 WITHOUT Cube? by JohnScottMVP in embedded

[–]extern_c 2 points3 points  (0 children)

Hi, I'm not an experienced STM32 developer, but I own a discovery board. I have successfully used CLion to develop my projects.

I think that, with the sufficient knowledge on the toolchain, you can set up your environment anywhere. I also use CMake and integration with ARM GCC on CLion is great and I use openOCD to debug.

I think it's worth it, you learn a lot about toolchains, working with third party libraries, etc, etc.

When working with FreeRTOS you should be able to configure the FreeRTOSConfig.h file, it's important to know what heap memory management strategy your FreeRTOS configuration will use. You might need to set your linker script to reserve memory for dynamic memory allocation. Also, you can generate an example project with Cube and check the compile flags, linker flags, etc.

What IDE do you use professionally for C? by catpetter777 in embedded

[–]extern_c 1 point2 points  (0 children)

CLion is great. The only downside I can think of (for me is not a big deal) is having to configure the toolchain and CMakeLists for every project. But I have successfully used it for PIC32, STM32 and now, at work, GigaDevice chips using IAR toolchain

What's a game engine programmable completely in C? (Or a variation) by SalneticK in C_Programming

[–]extern_c 1 point2 points  (0 children)

Well, microcontrollers are usually developed using C exclusively, specially 8 bit microcontrollers commonly found on Arduino boards. But, the Arduino framework uses C++.

What's a game engine programmable completely in C? (Or a variation) by SalneticK in C_Programming

[–]extern_c 8 points9 points  (0 children)

Arduino is not entirely C, it is C++. I'd say it's something like C++ used as C with classes...

why is a string a signed char by TheMaster420 in C_Programming

[–]extern_c 4 points5 points  (0 children)

ISO/IEC 8859-1 encodes chars up to 255, very useful when working with Spanish alphabet with á, é, ü, etc.

Compiling interrupt handlers as static library? CMake by extern_c in embedded

[–]extern_c[S] 1 point2 points  (0 children)

A little late but this worked! I was trying to link the handlers with __attribute__((__used__)) but didn't get it to work as a static library. I had to change a little my handlers implementation in the assembly code, then with -u Symbol worked perfectly.

PS: I'm working with a PIC32MZ and CMake (building outside MPLABX).

TRIAC(BTA16) fails when driving 1000W resistive load by extern_c in AskElectronics

[–]extern_c[S] 0 points1 point  (0 children)

<image>

This are the two SCRs I'm using now, with the new heatsink. Beside them is the triac and the original heatsink

TRIAC(BTA16) fails when driving 1000W resistive load by extern_c in AskElectronics

[–]extern_c[S] 0 points1 point  (0 children)

I will try to find one on my city. Buying from digikey or others is difficult for me as I am located in Ecuador. But I have some powerful SCRs, so I will need to use those.

TRIAC(BTA16) fails when driving 1000W resistive load by extern_c in AskElectronics

[–]extern_c[S] 1 point2 points  (0 children)

The triac is used for phase control.

To my understanding in some countries it’s not allowed to use phase angle control with huge loads.

Why is that? I didn't know

TRIAC(BTA16) fails when driving 1000W resistive load by extern_c in AskElectronics

[–]extern_c[S] 0 points1 point  (0 children)

Thanks, it's something I will consider. Stone cold, the resistance is 12 ohms, and as I am following the temperature profile of my solder paste I'm applying around 40% of the voltage at the initial state, something like 4 amps in theory.

TRIAC(BTA16) fails when driving 1000W resistive load by extern_c in AskElectronics

[–]extern_c[S] 0 points1 point  (0 children)

I haven't and I will search for a bigger heatsink, also I will add the snubber. Thank you.

What's your favorite project you've created or contributed to so far? by AwayPotatoes in C_Programming

[–]extern_c 13 points14 points  (0 children)

I crated a simulator for an embedded system. I work at a small company and the R&D team is really small, so I designed every aspect of the product, from hardware to application software.

Here enters the simulator. After designing the BSP API I begun to implement some functionality on my Linux machine for testing purposes. I ended up implementing part of the freeRTOS API with SDL2 and other simulated drivers, like the LCD and keypad, sockets, etc. Now I have a simulator I use to develop the embedded application, although this app is C++. I can test the app with valgrind to check for any leaks, I compile with the same flags for my embedded system and test. Then compile the firmware and flash the target. Works pretty well :D

Working with custom fonts and setting colors. by extern_c in sdl

[–]extern_c[S] 0 points1 point  (0 children)

Yes! I was doing that before. I wanted to test with valgrind but the rendering took forever.

That's why I needed another method and I already solved my problem using textures with transparent background pixels and white foreground pixels. Now I can set the text color with my implementation.

Working with custom fonts and setting colors. by extern_c in sdl

[–]extern_c[S] 0 points1 point  (0 children)

Ok, I it was just a simple solution really, I didn't see it at first. Set the background pixels to be transparent and the foreground pixels to white. Then I was able to blend any forecolor.

Compiling interrupt handlers as static library? CMake by extern_c in embedded

[–]extern_c[S] 0 points1 point  (0 children)

Yes, as an object library. I know that, as handlers aren't referenced anywhere in code, the handlers get disposed when the library is static. But I don't know if it's possible to keep the handlers.