![]() ![]() No offense meant, but that is what we are trying to escape. (new Port_c_device)->Set_out_pins_high(Port_device::Pin7) (new Port_c_device)->Set_pins_direction_out(Port_device::Pin7) If I was required to write this in my application code I think I would skip C++. You are making it more complicated than it needs to be. I'm using the C++ compiler that came with the last Atmel Studio 7 Version Maybe the jmp could be replaces with rjmp also, but I don't know how far the rjmp can jump. I don't know much about the AVR instructions, but it seems the call could be replaced with rcall. lss files and I noticed one place where the C compiler used rcall and rjmp and the C++ compiler used call and jmp. One reason for the bigger C++ program could be that the C++ compiler doesn't produce as good AVR code. ![]() I could easily add RTC to the c++ program. If someone could find a C blinker program for the Xmega that uses RTC instead of delay_ms, that would be great. If we could get a bit more complex program to compare, that would be good. Still nothing compared to the skin rashes and headaches I would get just thinking of using C. So that would make it 8 out of 300 bytes. However It does seem that the system is reserving half of the 800 for interrupt vectors or something for my Xmega 128a4u. The resulting C++ program was 8 bytes bigger than the C program.Ĩ bytes out of 600 is trivial to me. I made a copy and replaced the three C style port I/O functions with C++ functions in the copy. I found a simple C Xmega program that blinks a LED using delay_ms. My simple test shows only a little increase in code size. I am sceptical of reports of C++ generating more machine code than C. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |