Author Topic: One Dollar One Minute ARM Development  (Read 89263 times)

0 Members and 1 Guest are viewing this topic.

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #75 on: September 09, 2014, 10:18:07 am »
Probably some sort of necessary clock initialization.

It's not obvious how that could happen. At reset PLLON is clr but HSION is set so should be running, maybe not maximum speed. I don't see how any application could run without a crystal if that's the case yet the example I posted does. What a mystery.

If somebody could post a small hex file for one of the ST C demos or some other popular blinky I could get to the bottom of this quickly. Unfortunately I'm not set up for that ATM.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: One Dollar One Minute ARM Development
« Reply #76 on: September 09, 2014, 11:27:39 am »
Quote
I could get to the bottom of this quickly.

This is why no body can afford to code in assembly if her/his time means something, anything.
================================
https://dannyelectronics.wordpress.com/
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #77 on: September 09, 2014, 11:52:48 am »
It's amazing how many don't get this. Just jump to the end of a thread and start making noise. I will repeat that the intent here is not to create a race of human centipede uber-coders. I can program in C and spend a lot of time doing that. The goal here is to develop a set of absolute MINIMUM tools for a common ARM device pretty much for the sake of doing just that. Understanding more about the machine and tools is an incidental but IMO beneficial side effect.

As insane as it sounds a buddy of mine actually builds quite fancy ships inside a wine bottle using tweezers and teriyaki sticks. No matter how often I try to explain that it would make much more sense to simply assemble one on the tabletop and put it inside a peanut butter jar he just won't listen. Some people!

If you want to contribute something constructive how about attaching one of those really small blinky images you brag about all the time. You know, for this chip. We know you have the tools.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #78 on: September 09, 2014, 12:06:40 pm »
I do love assembler, but on mips, arm or any other RISC processor I rather use C or C++.
They usually have enough memory and speed that really doesn't matter, but I do get the power of assembly and once you have a bunch of cool modules done you can link them to your C code :)
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #79 on: September 09, 2014, 12:08:00 pm »
lol.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #80 on: September 09, 2014, 12:27:45 pm »
lol.

I'm not really kidding, but for example for Arm processors that don't have native floating point or even integer division like the M0 assembly is the way to implement it.

So anything related to inner loops, assembly will give you an edge, the upper control stuff doesn't matter much since everything can run at 100 Hz now a days and a couple of microseconds is not going to make a difference at that level.
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 1878
  • Country: nl
Re: One Dollar One Minute ARM Development
« Reply #81 on: September 09, 2014, 01:09:57 pm »
Saturating arithmetic also is a legit use of asm om arm as far as I'm concerned. Mostly as inline assembly used from C. But indeed, sometimes constructing a fast loop in asm can be fun too. Only to find out later that in some (but not all) cases the optimizer does a better job than you. :P
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #82 on: September 09, 2014, 01:30:15 pm »
Yes, it's hard for a human to compete with some of these compilers and GCC is pretty damn good for the money. I'd say that 99% of the assembler I've learned came from examining list files of C routines. The big problem is compiler overhead. For example my LED routine comes out a little over 100 times bigger when compiled instead of assembled. Of course the difference is much less with programs of significant complexity.
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 836
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #83 on: September 09, 2014, 01:31:42 pm »
The goal here is to develop a set of absolute MINIMUM tools for a common ARM device pretty much for the sake of doing just that. Understanding more about the machine and tools is an incidental but IMO beneficial side effect.

[...]

If you want to contribute something constructive how about attaching one of those really small blinky images you brag about all the time. You know, for this chip. We know you have the tools.
Well, "absolute MINIMUM" and "common ARM" are conflicting requirements. The minimum requirement puts you in the lair of the RCC/clock dragon, which blasts different fire for each OEM. If you were willing to leave the teriyaki sticks in the kitchen, you could do a nice minimum build over CMSIS, slaying the RCC beastie with a single call to SystemInit(). That would be in C, of course, but you have to choose: macho assembler warrior or stealthy C assassin?

To regain some nerd cred, you might consider re-writing the post-initialization blinky bits in GCC's inline assembler. That would be sufficiently awful to keep the pragmatists off your doorstep and entertain the eastern European whiz-kids.

I'd post a .hex, but all of mine have an RTOS in the middle.  >:D
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #84 on: September 09, 2014, 01:40:48 pm »
Well, "absolute MINIMUM" and "common ARM" are conflicting requirements.

I disagree. The device I've chosen is more popular than it's next competitor by a huge margin if listing statistics on places like Ebay, Aliexpress, and many other websites are an indication. And when you have attached a fully functional toolset to a forum like this instead of just links that argument would be more convincing.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #85 on: September 09, 2014, 01:43:54 pm »
RTOS. lol.
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 1878
  • Country: nl
Re: One Dollar One Minute ARM Development
« Reply #86 on: September 09, 2014, 02:22:02 pm »
RTOS lol yes. I suffer from the same affliction. RTOS, C, C++, asm all rolled up in one project. Because ... why not?  :-//  You use whatever tool gets the job done.

Programming in asm every now and then is fun, but I'm definitely not going to write entire applications in it. ;)
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 2534
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #87 on: September 09, 2014, 02:44:39 pm »
Quote
Quote
    Probably some sort of necessary clock initialization.
It's not obvious how that could happen.
I was thinking something like "well, the CPU clock defaults to the 8MHz internal HSI, and you enabled the clock from the APB2 bus to the GPIO port, but you forgot to turn on the clock for the APB2 bus itself." (though it doesn't look like that should be necessary.)  Or perhaps I can't use GPIO_Speed_10MHz if the clock is only 8MHz.

Then there is the (horribly documented) APB2RSTR register...
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 2534
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #88 on: September 09, 2014, 07:00:06 pm »
I put up a new version of the .asmh file.
It includes some macros STRUCTDEF/STRUCTEND and support infrastructure, to allow simple C structures to be relatively easily converted to assembler symbols.  So code that looks like:
Code: [Select]
/**
  * @brief CRC calculation unit
  */
STRUCTDEF CRC
  __IO uint32_t DR;
  __IO uint8_t  IDR;
  uint8_t   RESERVED0;
  uint16_t  RESERVED1;
  __IO uint32_t CR;
ENDSTRUCT
(which is easy to get from the C-style .h file using some editor keyboard macros) ends up producing assembler that defines CRC_DR=0, CRC_IDR=4, CRC_RESERVED0=5, CRC_RESERVED1=6, CRC_CR=8...

And then I added all the stm32f103 peripheral internal structure definitions.
(The CAN peripheral is incomplete.  A CAN peripheral apparently includes arrays of CAN_TxMailBox structures, and my macros aren't up to doing nested structures.)

This requires a bit of editing of the blink.S sketch I posted (remove the _O from the offset names of the manually-defined GPIO peripheral registers.)

(Needless to say, this has not been extensively debugged.)

I suggest adding "-mcpu=cortex-m3" to the assembler command  line, and you might want to consider "-asl=blink.lis" to generate a "significantly aware" listing file (which has advantages and disadvantages.  The concise output produced by objdump is ... concise.  The assembler listing ... isn't. (91 pages for blink.lis  Mostly the (largely useless) bitmask symbols, which could be omitted by using -al=blink.lis instead.)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: One Dollar One Minute ARM Development
« Reply #89 on: September 09, 2014, 08:31:47 pm »
Quote
We know you have the tools.

I didn't want to deprive you of the hardly earned bragging rights of developing an almost-working blinky after a few days. That must be the longest one minute in history, :)

Yes, I have the tool.

But, I don't have the time to waste.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 4565
  • Country: nl
Re: One Dollar One Minute ARM Development
« Reply #90 on: September 09, 2014, 08:33:48 pm »
Assembler only when C is not sufficient, for instance with large multiplications you can not transfer the carry with C  :(
The assembly routine is much faster. But there you can use inline assembly.
People who write everything in assembler are probably from the 80's where you had 256 byte ROM sizes, now with modern ARM controllers going >2MB ROM good luck, would love to see someones IP stack written in assembly  :-DD
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: One Dollar One Minute ARM Development
« Reply #91 on: September 09, 2014, 08:38:27 pm »
Quote
would love to see someones IP stack written in assembly

or a fft routine fully in assembly.

Writting assemblies has its place: when you are pushing the envelope of performance or resources (tons of money for example).

Most of us just cannot afford to write in assembly, in terms of skill, resources (time included), or necessity. C is much cheaper.
================================
https://dannyelectronics.wordpress.com/
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 2534
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #92 on: September 09, 2014, 08:58:37 pm »
Heh.   Implement the core arduino functions, in asm, designed to be called from asm...

 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: nl
    • NCT Developments
Re: One Dollar One Minute ARM Development
« Reply #93 on: September 09, 2014, 09:35:58 pm »
Quote
would love to see someones IP stack written in assembly

or a fft routine fully in assembly.

Writting assemblies has its place: when you are pushing the envelope of performance or resources (tons of money for example).
Most of us just cannot afford to write in assembly, in terms of skill, resources (time included), or necessity. C is much cheaper.
There are very few places where an assembly programmer can create faster code than a C compiler nowadays. A C compiler can take caching, branche prediction, pipelining, etc into account. Besides that it is often much more efficient to choose a better algorithm (or come up with one) than trying to speed up a less efficient algorithm.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #94 on: September 09, 2014, 10:54:03 pm »
I agree. These GCC routines were developed over many years by some of the top assembly language coders in the world. I know the examples I've extracted from list files were impossible for me to improve in terms of speed or size. IIRC more than once on forums like AVRfreaks (where asm is also feared by many) challenges were proposed but few succeeded. I think the only fellow who did was that Russian guy who got banned by shamed and frustrated mods. Another example might be the Multiwii project where expert coders spent huge effort to speed up cycle time, including hundreds of posts dealing with assembly tweaks, with little or no actual benefit.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6004
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #95 on: September 09, 2014, 11:43:04 pm »
Prompted by a request for simple low cost intro to the 32bit world in this thread: ...

This thread went completely off from being 'simple' or 'intro'.
Drain the swamp.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #96 on: September 10, 2014, 12:29:37 am »
How did I know you were going to say that? Evidently "simple" is in the eye of the beholder. Last week I didn't just link but actually attached a 100% functional set of tools for creating ARM programs. This was the first time anything even close was done here or any other forum AFAIK. I also set up a script that involves hitting a key on your PC keyboard or clicking with a mouse. I don't think anything like that has ever been done before either. Also note that these scripts are so small and simple can fit into text files of a couple dozen bytes.

The "zapta challenge":

Just to reiterate:

ARM hardware $1 and change.

Ability to start coding and flash in about a minute after downloading tools. In fact the package chosen is so compact this most likely includes  download time too.

So I'm quite pleased and really do not require recognition or complements because it's obviously hard to say anything with those human centipede stitches in ones mouth.

BTW With some help from an offline hex (actually elf) contribution and oocd the mystery of why westfw code don't run on reset is solved. Unbelievable.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6004
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #97 on: September 10, 2014, 12:54:56 am »
How did I know you were going to say that?

Because it's true.

In the other thread you said that you will recover a simple ARM introduction that you presented in some ham club but this thread doesn't deliver.
Drain the swamp.
 

Offline paulie

  • Frequent Contributor
  • **
  • Banned!
  • Posts: 849
  • Country: us
Re: One Dollar One Minute ARM Development
« Reply #98 on: September 10, 2014, 12:57:17 am »
How did I know you were going to say that?

Because it's true.

In the other thread you said that you will recover a simple ARM introduction that you presented in some ham club but this thread doesn't deliver.

How did I know you were going to say that? LOL
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: One Dollar One Minute ARM Development
« Reply #99 on: September 10, 2014, 01:33:52 am »
Girls, play nice and don't fight with each other.

Quote
actually attached a 100% functional set of tools for creating ARM programs.

If that's the case, why waste time on creating a half-functioning assembly code? Give people .axf and you are done.

If you want to see how others have done this, check out some of the stm8 software usb examples on the web.

Blinking an led on this board (or pretty much any other board, arm or not) is fairly easy, especially for a C expert like yourself. Why compete where your skills are none by writing in assembly?

If you cannot write a blinky in C, I posted a short piece in the ghetto thread that blinks an led on any STM32F10x chips. It would be a ride in the park for a seasoned C programmer like yourself to get it going on your hardware.

From where I sit, you haven't demonstrated the need, skills or resources to code in assembly.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf