Updated from 6:02 p.m. EDT

SAN FRANCISCO -- Sirf Technology ( SIRF) posted a large loss in the second quarter, as hefty writedowns and weak demand took a toll on the troubled chipmaker.

Sirf said its gross margin was cut in half to 21%, compared with 42.6% in the first quarter.

"This was a challenging quarter for Sirf with weakness in demand from our OEM and ODM customers, especially in the portable navigation device space, and continued competitive pressures that impacted both our revenue and margins," Sirf said in a statement.

And the third quarter doesn't look much better: Sirf said during its conference call that it expects revenue in the current quarter between $60 million and $64 million, vs. the $69.9 million expected by analyst.

The company said adjusted EPS will range between a loss of 17 cents to a loss of 21 cents. Analysts were looking for the company to breakeven, excluding stock compensation expenses.

Shares of Sirf fell more than 12% in recent after-hours trading to $3.70.

The San Jose, Calif., maker of GPS chips posted a second-quarter loss of $332.6 million, or $5.41 a share, in the second quarter, compared with a profit of $2.1 million, or 4 cents, at this time last year.

Sirf said the loss included a $215.7 million goodwill impairment charge, as well as some $90 million in special charges for items including impairment to acquisition-related intangibles and note receivables, as well as income tax provisions and stock compensation expenses.

Excluding most items, but including $10.3 million in stock compensation expense, the company lost 19 cents a share.

Using current share counts, the company lost 29 cents a share excluding stock expense; analysts polled by Thomson Reuters were expecting a 28-cent-a-share loss on that basis.

Sales in the three months ended June 30 totaled $63.1 million, compared with $70.6 million at this time last year. The average analyst expectation was $62 million.

One of the pioneers of the market for the GPS chips -- which communicate with overhead satellites to pinpoint a person's geographic location -- Sirf has fallen upon hard times as a slew of competitors including Atheros ( ATHR), Broadcom ( BRCM) and Qualcomm ( QCOM) have jumped in the market and pushed down prices.

What's more, demand for the portable navigation devices that use Sirf chips, made by companies like Garmin ( GRMN) and TomTom , appears to be falling off amid weak global economic conditions.

In the second quarter, Sirf said unit shipments of chips were up 10% year over year, while average selling prices were down 20%.

Sirf's stock is down more than 86% from its 52-week high of $30.61.

Earlier this year, semiconductor industry veteran Diosdado Banatao took over as interim CEO, ousting the previous management team and promising to get Sirf back on firm footing.

But even the company's turnaround efforts appear to be having difficulties.

In a post-earnings conference call Thursday, Sirf executives acknowledged that it has already written down the bulk of the $13.5 million investment it made a quarter earlier in a private, unnamed GPS company.

In response to the difficult conditions, Sirf said it will make further cuts to its workforce, with plans to lay off 7% to 9% of its employees by the end of September, while reprioritizing certain engineering projects.

The company said it is seeing "good design win traction" with its newer products but remains cautious in its outlook because of economic uncertainties and competitive challenges.