vilroi’s blog
Determining the Required Voltage to Turn a Transistor "On"
Edit 2025-01-18: In the initial revision of this post I had made a mistake and has since been updated. The mistake is explained in the later part of the post.
In order to pass a current from the collector to the emitter of a transistor 1 , one must apply a voltage across the base and emitter (another way to view this is that there must be a current between the base and emitter). How do we know how much voltage must be applied? We could of course simply refer to the data sheet or do a quick google search, but that would be kind of boring. Besides, how do we know that the information provided by those sources are trustworthy in the first place 2 ? Is there a way to determine and confirm the threshold voltage on our own?
…Quick and Dirty Guide to Building a Kernel Development Environment
Note:
- This article assumes that the reader is trying to build and run a linux kernel with qemu, on linux, in order to develop kernel modules.
- The author is not an experienced kernel developer. These are just notes to document their learning, and to keep for future reference.
- If you are only interested in setting up a minimal environment, feel free to skip to the Building the kernel section.
Background Knowledge
Setting up a development environment in which the developer is able to freely and safely abuse the kernel load and unload kernel modules is the first step in kernel hacking. There are other approaches to setting up an environment, such as installing the kernel on actual hardware and using a debug interface, or setting up a virtual machine, etc. In this article we explore how to run a locally built linux kernel using qemu
.
Notes on Go Interfaces
An interface
in Go is an abstract type used to categorize discrete types based on the actions it is able to take (the methods it implements).
More concretely, an interface is a data type represented as a set of function definitions.
Any type which implements the methods defined in the set can be treated as that interface.
- if type x implements methods A() and B() defined in interface a, then x can be treated as an a
- if type y also implements methods A() and B() defined in interface a, then y can also be treated as an a
- while x and y are distinct types, they can both be treated as type a
As an example, consider the types net.HardwareAddr
and netip.Addr
.
Since both of these types implement the String()
method, according to the definition of the fmt.Stringer
interface, both of these types can be treated as a fmt.Stringer
.
Kea, Raw Sockets, and ICMP
The other day I was taking a look at kea, an open-source DHCP server from ISC for my home network.
I installed it on my gateway, made the minimal initial configurations, and fired it up.
Then I checked my laptop and confirmed that it had successfully been assigned an IP address from the range I had allocated.
So far so good.
I was about to proceed to checking out the other parts of the configuration and the documentation.
…Case of the Forgotten 'volatile' Qualifier
Background
I had gotten back into tinkering with embedded stuff recently, and was writing some test code to get a better understanding of how timers work.
Specifically, I had written something like the following to be run on the EK-TM4C123GXL Evaluation Board:
int main(void) {
init();
init_timer();
while (1) {
if (SYSTICK_STCTRL_R & SYSTICK_COUNT_FLAG)
toggle_led();
}
}
where
#define SYSTICK_COUNT_FLAG 0x10000
#define SYSTICK_STCTRL_R DEFINE_SYSTICK_REGISTER(0x10)
and
#define SYSTICK_BASE_R (0xe000e000)
#define DEFINE_SYSTICK_REGISTER(offset) *((uint32_t *) (SYSTICK_BASE_R + offset))
which basically becomes the following after going through the pre-processor:
…Hello World
Hello world.
More content will come soon… (hopefully…)
…