Tag Archive for 'C'

Extending std::exception

So you’re writing some C++ code, feeling all object oriented and all, and you decide you’d like an application specific exception whenever one of your methods has an issue. You’d like to have error messages that the exception can print up if thrown and you think to yourself, “hey, I’ll just extend std::exception, add the […]

fx2lib documentation and source download

I’ve uploaded documentation and a source download for fx2lib. Here is the copy of the Sourceforge announcement. The fx2lib sources are stable enough to build complete firmware implementations for the cypress fx/fx2 variants of the 8051 chipset. The current release includes library functions for: delay functions endpoint functions register definitions type definitions macros for common […]

An Open Source Library for Writing Firmware on the Cypress FX2 with SDCC

After playing around with the Cypress FX2 and SDCC for the past while, I’ve developed a library of utilities that make some of the common tasks for writing firmware and performing certain functions a little easier. I’m lucky to work for a company that approves of the open source initiative and believes that it is […]

How much overhead does C++ bring compared to straight C?

The other day, I had a conversation about putting C code onto an embedded chip. I wondered if it was possible to put C++ code on there. The gist of the conversation was that the C++ libraries had a lot of overhead and the executable size would be too large for the space available on […]

3 Optimizations for speeding Visual C++ compiled code.

For fun, I participated in a programming contest. Instead of describing the process this time, I thought I’d include a function. Can you guess what it does? I’m changing some of the variable names so it isn’t obvious.  unsigned short result [dim][dim];void foo(const string& info1, const string& info2, string& ret_val) {  for (int x=0;x<dim;++x) { […]

Timing C/C++ Code on Linux

For my last post, I played around with C++ and a little programming competition. While on the topic, I decided I’d get slightly more serious and enter the next challenge. One of the things that slightly annoyed me during the process is having to compile/run the program on Windows to enter the competion, while I’m […]