Quantcast
Channel: ARM Connected Community: Message List
Viewing all 8551 articles
Browse latest View live

Re: Cortex-M0: What's included in the binary?

$
0
0

I always avoid things like "printf". printf uses fprintf and snprintf. fprintf needs fwrite, and fwrite means including all file I/O, including fopen, fread, fclose, fseek, etc. Usually it means I get a huge library, so instead, I either roll my own low-level routine that just sends a character over the UART for instance, and then another routine, which takes a string and send the string's characters one-by-one using the other routine.

 

Looking at the above, I see some exit and libshutdown references; that's completely redundant, because you never really exit your program on a microcontroller anyway - you would usually stay in a 'forever' while-loop. (Remember to put a __WFI(); in the loop, to save power, if you can).

 

The standard C library probably also wants malloc and free, two things that are not appropriate for most Cortex-M0 (unless they're combined with a Cortex-M4 for instance, like the NXP LPC43xx or LPC541xx; these have plenty of space).

So what I'd do in your place, would be to take a look at newlib nano. It's a smaller version of the standard C library, which is much more useful on smaller devices.

But I'd also try to avoid using functions that need the C-library for as long as possible.

-But if you at some point already need the standard library, then using it will not cost much extra. If you already must have printf, just in one place, keep using it, because you might be able to save space, when compared to rolling your own.

 

There are other library functions, which takes up a lot of space. For instance if you're using math multiplication or division. Mulitplication isn't really that bad, but dividing a 32-bit value by a 32-bit value producing a remainder and a quotient will generate a medium sized subroutine.

If you attempt to use floating point, then you'll get huge and very slow code. Avoid floating point, at almost all cost.

Normally, you'll need only integer math, it's also often much more precise (32-bit floating point only has 24-bit precision for instance).


Re: Cortex-M0: How to switch from one program to another

$
0
0

Now, this question keeps occupying my mind.

 

If you're only going to copy code to the RAM, then you could also do one of these things:

  1. Create fixed addresses for interrupt service routines (not really a good solution).
  2. Create indirect interrupt service routines. These are not completely 'transparent' but will forward interrupt-invocations "manually".
  3. Create 'ramcode' or 'fastcode' sections in your linker-script, and then have your startup-code copy small code snippets from Flash-memory to SRAM when the microcontroller starts up. This requires no modifications of the vector tables, these will be fixed and point to the SRAM address.

 

If you're interested in solution #3, I could send you an example linker-script and some startup-code. I could also write a document about it.

Re: Cortex-M0: How to switch from one program to another

$
0
0

Note: r6 should be 0, not 1.

It's only necessary to set bit 0 in PC, that is if you're changing PC directly.

So you should load the SP from address 0x00000000 and PC from address 0x00000004.

Bit 0 is already set for all handlers in the vector table, so you do not need to change anything.

 

ARM recommends using BX to load PC:

            movs        r0,#0

            ldr         r1,=SC

            str         r0,[r1,#VTOR]

            ldr         r1,[r0]

            mov         sp,r1

            ldr         r1,[r0,#4]

            bx          r1

 

... but if you need the code to be shorter, I believe the following will work ...

            movs        r0,#0

            ldr         r1,=SC

            str         r0,[r1,#VTOR]

            ldmia       r0!,{r0,r1}

            mov         sp,r0

            bx          r1

 

Edit: I've corrected this answer, so it would work for Cortex-M0+. As mentioned below, the Cortex-M0 (without plus), does not have the hardware register VTOR.

Re: Memory allocation for Cortex-M4

$
0
0

Hi jvanmont,

 

I think I understood your situation. You should copy from 0x08017170  (flash) to 0x2000099c (SRAM) in the startup routine. The value of SRAM area is undefined and you should initialize it by the values in the flash. If the ExtRAMData is an array of null data, you can directly write the values of 0 in the ExtRAMData. The program would be carried out only by VA.

 

Best regards,
Yasuhiko Koumoto.

Re: CTRLSTAT = 0xffffffff

$
0
0

,

after writing into flash  if i am trying to  reading from the flash address i got 0xffffffff i don't know why that happening ??

 

Thanks & Regards.

Re: Tribute to Charlie Hebdo's members

$
0
0

For the moment 3 terrorists dead, 17 17 dead civilians, a free accomplice in the nature ... Unfortunately, I think that will do not stop there .
all that for who, for what ? Some sheets in a newspaper... i'm just disgusted by humans . I preferred to be a snowman !

Tribute to civilians dead and deads of Charlie Hebdo due the terrorist attack on France

Re: What is the Linux 3D-Graphics Driver stack with  OpenGLES2.0  supporting for ARM Mali 400 GPU.

$
0
0

Hello,

 

what happens to the memory buffer after the GPU has rendered a frame depends all on the used windowing system.

In the most simplest case (no display present) the buffer stays where it is and one can write it out to the file system as an image file.

On systems with a framebuffer device the GPU can for example directly render into the memory associated with /dev/fb0.

More advanced windowing systems will do additional compositing of several off-screen surfaces to produce the final image to be displayed. That process of compositing can happen on the CPU, use the GPU again or use a dedicated hardware unit like Mali-DP550.

If you want to know how the various windowing systems (e.g. X11, Android) work in detail you need to read through their respective documentation - it's all slightly different and no short answer can be given.


Re: CTRLSTAT = 0xffffffff

$
0
0

Most likely your Flash memory is protected.

 

It's important that you know there are two unlock sequences.

 

First you will need to check that the LOCK bit of FLASH_CR is zero. If it is not zero, you will want to unlock it by sending the unlock sequence mentioned earlier:

0x40023c04=0x45670123. 0x4002c304=0xcdef89ab.

Then you may need to wait for a few milliseconds; I do not know how long, but try giving it a good delay at first, then you can reduce it and see when it fails.

Now read FLASH_SR first. It is important to check all the things in this register that can go wrong. In particular, we're interested in bit 4, the WRPERR bit.

-If the WRPERR bit is set, we're in trouble, but we'll also need to be free of other errors.

If there are no errors, however, then we can proceed and read FLASH_CR again, to verify that the LOCK bit is now zero.

 

If the LOCK bit of FLASH_CR is zero, then we can proceed.

Read the FLASH_OPTCR register. by reading address 0x40023c14. If this register does not contain 0x0fffaae1, then you'll most likely get write protection errors in FLASH_SR after attempting to write to the flash-memory.

So if FLASH_OPTCR register's bits 27:16 are not all 1, then we'll need to modify them. Bits 15:8 must be 0xaa. So we'll write the following:

0x40023c08=0x08192a3b. 0x40023c08=0x4c5d6e7f. 0x40023c14=0x0fffaaed.

Right after that sequence, we should read FLASH_SR, to check for errors.

Then read FLASH_CR and verify that the LOCK bit is still zero.

After that, we should read the FLASH_OPTCR register, to verify that the value is now changed; expect 0x0fffaae1.

 

OK, we're about to flash-program the device, so now we'll do the checking again.

Read the FLASH_OPTCR register (address 0x40023c14), if bits 27:16 are not all ones, we can't write to the flash-memory.

Now read FLASH_SR, and verify that there were no error reading FLASH_OPTCR.

Finally, read FLASH_CR and verify that the LOCK bit is still zero (I expect that it always is zero).

If all checks out, try writing a block of data to the Flash memory.

Right after writing the last 32-bit word of your data block, you should immediately read FLASH_SR and check for any errors.

If bit 4 is set, then you could not write to the flash memory, because it's write-protected (somehow that means that the FLASH_OPTCR does not contain the value we'd expect by now).

 

If any of the above sequences do not contain the values I wrote, please let me know, I could have made a typo.

Re: GL_EXT_buffer_storage support?

$
0
0

Hello,

 

am I right assuming your biggest interest in this extension is the feature of allowing persistent mappings?

Depending on how much data you generate per frame the overhead of mapping/unmapping either regions (provide the right flags if doing so) or even of rebinding a different buffer for each frame might be acceptable on our current implementation and gives an advantage over glBufferSubData calls.

 

We cannot comment on further plans or time lines for features.

 

Cheers,

 

Jörg

Re: What is the Linux 3D-Graphics Driver stack with  OpenGLES2.0  supporting for ARM Mali 400 GPU.

Re: scanner input ean-13

$
0
0

sorry but I am confused, I purchased the scanner from amazon. It claims to be an ARM product, what scanners do you guys have?

Re: What is the value of a license of an ARM Cortex-A53 processor?

$
0
0

Hi Elchicogeek,

 

I think you may need to contact the sales team of ARM. It won't be generally answered here.

 

Regards,

techguyz

Re: Cortex-A8 performance

$
0
0

Hi rlepage,

 

Did you wrote your own baremetal code or you took some reference code ?

 

Can you post the startup code and settings of your experimentation ?

Re: scanner input ean-13

$
0
0

We don't have any scanners.

ARM is an intellectual property company, we do not manufacture, design or sell barcode scanner.

 

If I was comparing to a car, it would be like calling the car the name of the farmer who is breeding cows just because it has leather seats. The farmer wouldn't be able to help with engine faults.

 

They are misleading you by using our name.


[CM3]which clock sources can be closed?

$
0
0

Hi bro,I am wondering which clock sources can be closed by software within stm32?thanks for helps.

Re: Application processor and baseband processor.

$
0
0

Thank you so much for your very helpful answer.

 

Could you please route me to a document that explains in details  what type of interconnect/bus/protocol is used for data exchange between the AP and the baseband is there any memory that is shared between the AP and the baseband or there is much like an interrupt based mechanism for notification etc...

 

 

Many thanks for the clarification.

Re: How to create a 7000hz signal from PWM ?

$
0
0

If this is not possible , I will use it a 555 to produce the desired signal . But I wish have an answer to this question. thank you

Re: How to create a 7000hz signal from PWM ?

$
0
0

I know this is absolutely overkill. You could use the SCT - it's overqualified for this task.

The SCT has a built-in state-machine, which you can use for changing the state from 1 to 0 and from 0 to 1.

You can then make an event, that happens when the state changes to 0, and another event when the state changes to 1.

Each event can for instance change the state of a pin.

I do not know how mbed code for this would look, though.

Re: [CM3]which clock sources can be closed?

$
0
0

Hi galileo1991 and welcome to the community.

 

The short answer is: Many,

Choosing a clock frequency on the STM32Fxxx depends on many things.

The STM32Fxxx microcontrollers have an internal clock oscillator (Resistor/Capacitor frequency generator), which can be chosen as clock-source. This internal clock source usually runs at 16MHz.

But you can feed the clock source into something called a PLL, which can multiply and divide the clock source, to generate for instance a clock frequency of 72 MHz or 48 MHz or 50 MHz from the same 16 MHz.

You can also choose to use an external crystal as a clock source for the PLL.

If you're using an external crystal, you'll be able to change the crystal in addition to using the PLL, that makes further possibilities.

 

As a quick rule of thumb (but not restricted to), you can clock your microcontroller at any clock frequency up to the microcontroller's maximum clock frequency. For many of the STM32Fxxx containing a Cortex-M3 core, this is 72MHz, but  there are some that allows you to use higher clock frequencies.

You can usually choose clock frequencies with 1 MHz intervals if you use for instance an 8 MHz external crystal.

-But again, you're not limited to this value.

 

If you have a device number (eg. the full name of the STM32 device), and there's a special clock frequency you'd like to check if it can be clocked at, please post the model and the frequency, then I'll try checking the closest frequency available (it might be an exact match). I may be able to provide you with a few extra options.

Viewing all 8551 articles
Browse latest View live