Including binary libraries – experiment in teaching

gbulmer
Mon Apr 03, 2017 1:28 pm
I’m thinking about doing an experiment in teaching students programming. A friend did this sort of thing in the ’80s, and it worked quite well. I think I might like to try it on the ‘current generation’.

The idea is to teach programming using one project on an Arduino or STM32. Part of the idea is to enable them to develop and experiment with a more sophisticated project earlier in the course.

The students start with a small amount of source and some binary libraries, then eventually over the duration of the course, code all of the libraries themselves. So they have quite a lot of functionality, provided by binary libraries, from the start.

I’m wondering how to do this within the Arduino IDE. Its usual mode is to have all source code available, but that would defeat my purpose.

I suppose I could create a bunch of alternative ‘target board’ builds, but is there an easier way? Any suggestions?

GB-)

A bit more about the approach
After they get used to the IDE and syntax, I’ll give the students an almost complete program which uses several libraries. They will complete the program, and test it. This might be quite a small amount of code, but gives a quite big pay-off. They won’t have the source code for the libraries only the binaries. They will have the header files.

Then each session I’ll teach them more, enough to implement a library, then another, and so on, until they have learned to implement the whole program.

As an alternative approach, I might ask them to work in small teams to implement the libraries. As an extra task, I might even ask them to exchange one or more library implementations with other students or teams of students, and check that the program still works (working to spec.).


zmemw16
Mon Apr 03, 2017 9:00 pm
if you use a program that functions in AVR Arduino and then also in STM32 Arduino, with appropriate library changes, that would allow the introduction of ‘porting’ to a platform as a topic?
perhaps explaining the #if constructs (for me ;) )?
also nasties like hardware timers, DHTnn interface ?
stephen

gbulmer
Tue Apr 11, 2017 2:03 am
zmemw16 wrote:if you use a program that functions in AVR Arduino and then also in STM32 Arduino, with appropriate library changes, that would allow the introduction of ‘porting’ to a platform as a topic?
perhaps explaining the #if constructs (for me ;) )?
also nasties like hardware timers, DHTnn interface ?
stephen

zmemw16
Tue Apr 11, 2017 3:06 am
i wouldn’t be that cruel either, however introducing them to stm32 and limiting them to then use avr, also smacks of cruelty :)
stephen

mrburnette
Wed Apr 12, 2017 12:51 am
gbulmer wrote:
<…>
I’m wondering how to do this within the Arduino IDE. Its usual mode is to have all source code available, but that would defeat my purpose.

I suppose I could create a bunch of alternative ‘target board’ builds, but is there an easier way? Any suggestions?
<…>


BennehBoy
Wed Apr 12, 2017 8:28 am
I found that when I was using notepad++ and the nppexec plugin to launch the command line IDE compiler, a build path could be set, this then persisted the object code….

There are details of how to configure np++ on the forums here, but the specific command line was:

“c:\Program Files (x86)\Arduino\arduino_debug.exe” –pref build.path=”$(CURRENT_DIRECTORY)/build” –verify “$(FULL_CURRENT_PATH)”

$(CURRENT_DIRECTORY) & $(FULL_CURRENT_PATH) being expansions made by np++


gbulmer
Thu Apr 13, 2017 1:43 am
mrburnette wrote:gbulmer wrote:
<…>
I’m wondering how to do this within the Arduino IDE. Its usual mode is to have all source code available, but that would defeat my purpose.

I suppose I could create a bunch of alternative ‘target board’ builds, but is there an easier way? Any suggestions?
<…>


gbulmer
Thu Apr 13, 2017 1:52 am
BennehBoy wrote:I found that when I was using notepad++ and the nppexec plugin to launch the command line IDE compiler, a build path could be set, this then persisted the object code….

There are details of how to configure np++ on the forums here, but the specific command line was:

“c:\Program Files (x86)\Arduino\arduino_debug.exe” –pref build.path=”$(CURRENT_DIRECTORY)/build” –verify “$(FULL_CURRENT_PATH)”

$(CURRENT_DIRECTORY) & $(FULL_CURRENT_PATH) being expansions made by np++


gbulmer
Thu Apr 13, 2017 1:55 am
gbulmer wrote:BennehBoy wrote:I found that when I was using notepad++ and the nppexec plugin to launch the command line IDE compiler, a build path could be set, this then persisted the object code….

There are details of how to configure np++ on the forums here, but the specific command line was:

“c:\Program Files (x86)\Arduino\arduino_debug.exe” –pref build.path=”$(CURRENT_DIRECTORY)/build” –verify “$(FULL_CURRENT_PATH)”

$(CURRENT_DIRECTORY) & $(FULL_CURRENT_PATH) being expansions made by np++


gbulmer
Thu Apr 13, 2017 1:58 am
BennehBoy wrote:I found that when I was using notepad++ and the nppexec plugin to launch the command line IDE compiler, a build path could be set, this then persisted the object code….

There are details of how to configure np++ on the forums here, but the specific command line was:

“c:\Program Files (x86)\Arduino\arduino_debug.exe” –pref build.path=”$(CURRENT_DIRECTORY)/build” –verify “$(FULL_CURRENT_PATH)”

$(CURRENT_DIRECTORY) & $(FULL_CURRENT_PATH) being expansions made by np++


gbulmer
Thu Apr 13, 2017 2:02 am
zmemw16 wrote:i wouldn’t be that cruel either, however introducing them to stm32 and limiting them to then use avr, also smacks of cruelty :)
stephen

gbulmer
Mon May 01, 2017 1:48 pm
I’ve been thinking a bit more about this.

Trying to put compiled ‘.o’ files in a temporary directory has a serious downside. Somehow I’ll need to have my software installed on all of the machines being used, which might be too tricky.

However, maybe there’s an alternative, potential, solution.
The idea is to initialise some arrays with the actual (hex) code of the library functions, and use a few pragmas/compile-time directives to have those arrays placed into the text (code) segment of the linked program.

To get the linker to work, I think the arrays would need to either have the same names as the function names, or the entire .o file would need to be within an array. I don’t know which would be a more likely approach.

Has anyone ever tried to embed code using initialised data and nifty use of the compiler directives?


Hans Leuthold
Thu May 18, 2017 9:38 pm
hello gbulmer,
I just took a class at Cabrillo College in Santa Cruz California on Arduino Uno based C++

here is a link https://sites.google.com/a/cabrillo.edu … 7/schedule

I will forward the link to your post to the teacher of the class and hope to create a beneficial connection for both of you

Hans


Leave a Reply

Your email address will not be published. Required fields are marked *